Jump to content
Sign in to follow this  
shms

Insert Problem

Recommended Posts

ni aku ade wat save function ..tp ada error gini yang kuar ... ada tak sesapa yg tau

1010 - STUFFPT Update requires the InsertCommand to have a connection object. The Connection property of the InsertCommand has not been initialized.

ni code nye ..

public bool SaveEditCodeTemplate(CodeDescription.TugBoatCls cTug)
    {
        bool bOK = false;
        try
        {
            DataRow dr = null;
            OpenCodeTable(cTug);

            if (dsUser.Tables["STUFFPT"].Rows.Count > 0)
                dr = dsUser.Tables["STUFFPT"].Rows[0];
            else
                dr = dsUser.Tables["STUFFPT"].NewRow();

            dr["BRANCHID"] = cTug.branchid.ToString();//ADDED 280107
            dr["CODE"] = cTug.txtVClass_Code.ToString();
            dr["DESC1"] = cTug.txtVClass_Desc.ToString();
            dr["PORT"] = cTug.txtPort.ToString();
            dr["STATION"] = cTug.wcbCustom.ToString();

            if (dsUser.Tables["STUFFPT"].Rows.Count == 0)
                dsUser.Tables["STUFFPT"].Rows.Add(dr);

            SetTugTemplateAdapter();

            if (!UpdateDBTable("STUFFPT", ref ad, ref dsUser))
                _errmsg = this.GetErrorMsg;
            else
                bOK = true;

        }
        catch (Exception ex)
        {
            _errmsg = "SaveEditCountryTemplate->" + ex.Message;
        }
        return bOK;
    }

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...