i amusing visual studio 2005.
i have initialized my connection in a module.
conn is the name of my connection
this is the Code
Public Class frmCreditNoteRequest
Dim adapter As SqlDataAdapter
Dim cmd As SqlCommand
Dim ds As New DataSet
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
Dim test As Boolean
Dim sql As String
sql = "INSERT INTO CreditNoteDetails (RequestedDate,CusId,Details,RequestedAmount) VALUES ('11-10-2008',2,'test',3000.00);"
conn.Open()
MsgBox("conection has open")
test = conn.State 'to check the connection state
MsgBox(test)
cmd = New SqlCommand(sql, conn)
conn.Close()
adapter = New SqlDataAdapter
adapter.InsertCommand = cmd
MsgBox("You have successflly updated")
End Sub
End Class
[size=5]
What is wrong in this coding plz help meeeeeeeeeeeeeeeee[/size]
|