update changes to database?

ssfftt

Well-known member
Joined
Oct 27, 2005
Messages
163
Programming Experience
1-3
I have MSSQL table called "category";, contains CID(pk),CNAME(unique identifier), SHORTDESC.on my form, i have txtname.text (databinded with the CNAME column) and txtshortdesc.test (binded with the SHORTDESC column). when i make some change, i have a button "modify"; to update the change to the database. I trid the code below, but didnt work, can anyone help plz?
VB.NET:
     Private Sub btnModify_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnModify.Click        SqlConnectionCategoryMgt.Open()        SqlUpdateCommand1.Parameters("@CNAME").Value = txtCategoryName.Text        SqlUpdateCommand1.Parameters("@SHORTDESC").Value = RTBDesc.Text        SqlUpdateCommand1.ExecuteNonQuery()        SqlConnectionCategoryMgt.Close()    End Sub
the SQL of SqlUpdateCommand1 is
VB.NET:
UPDATE    CATEGORYSET              CNAME = @CNAME, SHORTDESC = @SHORTDESCWHERE     (CID = @Original_CID);                          SELECT     CID, CNAME, SHORTDESC                           FROM         CATEGORY                           WHERE     (CID = @CID)
 
ok, seems no one can be bothered trying to solve my silly question, however, i fixed it myself in a silly way. cheers
 
Back
Top