Monday, 9 September 2013

Data is not updated into the databse?

Data is not updated into the databse?

pI wish to do insert and update the data from the textbox./p pWhy my data
is not updated into the databse? (Microsoft SQL Server Management Studio)
Anyone please help me. Appreciate!/p precode //connection //update If
dt.Rows.Count gt; 0 Then sql = Update adm SET qty = ' amp; txtqty.Text
amp; ' Where ........ cmd = New SqlCommand(sql, conn) 'conn.open()
cmd.ExecuteNonQuery() lbl2.Text = lt;stronggt;Data update!
lt;/fontgt;lt;/stronggt; txtqty.Text = Else // do insert crow =
ds.tables(adm).newrow() crow(xxx) = Session(xxxx) crow(xxx) = Session(xxx)
crow(xxx) = xxxxx crow(xxx) = xxxxx crow(xxxxx) = xxxxx crow(xxxx) = xxxxx
crow(xxxxx) = xxxxx crow(xxxx) = xxxxx crow(xxxx) = xxxxx crow(qty) =
trim(txtqty.text) ds.tables(adm).rows.add(crow) da.update(ds, adm)
lbl.Text = lt;stronggt;Data saved! lt;/fontgt;lt;/stronggt; conn.close()
End If /code/pre pHere is the connection/p precode sql = SELECT * FROM adm
conn = New SqlConnection(ConnStr) cmd = New SqlCommand(sql, conn)
conn.open() da = New SqlDataAdapter(cmd) cb = New SqlCommandBuilder(da) ds
= New DataSet da.fill(ds, adm) dt = ds.Tables(0) /code/pre

No comments:

Post a Comment