Details not updating in SQL database
Hi experts,
I have written some line of codes for a web page to update the data into sql database. There is no any error display.The only problem is that details are not updating in the database. This code works fine in vb.net.
Public Sub savedata(ByVal job_code As String, ByVal year As String, ByVal month As String, ByVal system As String)
Dim i As Integer
Dim cu As SqlCommandBuilder
cu = New SqlCommandBuilder(da)
da = New SqlDataAdapter("select * from DTS_DETAILS", sqlcon)
ds = New DataSet
da.Fill(ds, "DTS_DETAILS")
i = MsgBox("Are you sure to save the details", MsgBoxStyle.YesNoCancel, "Save ?")
If i = 6 Then
Dim dr As DataRow
dr = ds.Tables("DTS_DETAILS").NewRow()
dr.Item(0) = job_code
da.InsertCommand = (New SqlCommandBuilder(da)).GetInsertCommand()
da.Update(ds, "DTS_DETAILS")
MsgBox("Data updated successfully")
sqlcon.Close()
End If
End Sub
[1100 byte] By [
shivkumar] at [2007-11-20 7:04:27]

# 3 Re: Details not updating in SQL database
But is there any problem with message box in asp page ?
Yes,,:rolleyes:
The message box will open on the server, not on the client. So the execution of the page will stop until somebody closes the message box on the server..
Maybe you can't feel this because you test your code on the local machine. try to open your application from a remote computer..
hspc at 2007-11-9 11:55:06 >

# 4 Re: Details not updating in SQL database
Ok, and thanks a lot for the information and quick reply.
I have removed the message box from the code.
But the problem is still same. Data is not getting updated in sql database, while there is no any error in the code.
Please suggest how to go about that.
# 6 Re: Details not updating in SQL database
I got the mistake I was making.
I just added the following line
da.InsertCommand = (New SqlCommandBuilder(da)).GetInsertCommand()
and it started working properly.