fireblade
09-27-2007, 10:52 PM
Below is my code created in vb.net to insert customer record using a stored procedure.
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
comm.CommandType = CommandType.StoredProcedure
comm.CommandText = "insertCustomer"
comm.Parameters.Clear()
comm.Parameters.Add("@Name", SqlDbType.VarChar, 50).Value = Me.txtName.Text
comm.Parameters.Add("@Desc", SqlDbType.VarChar, 50).Value = Me.txtDesc.Text
comm.Connection = conn
conn.Open()
Dim afRows As Integer = comm.ExecuteNonQuery()
conn.Close()
If (afRows) Then
MessageBox.Show("Records successfully added. affeced rows = " & afRows)
End If
End Sub
I have another function aLso which display the records when i give a CustomerID.
Records are ennterd and successrully added to the database. It aLso shows the relevan record for the CustomerID.
but after stoping and restart the debugging process, the records are not displayed.
I think the changes are not committed to the database & after closing the program it rollbacks. I dont know whether it is correct or wrong.
Can any one give me a good idea that i can understand weLL please?
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
comm.CommandType = CommandType.StoredProcedure
comm.CommandText = "insertCustomer"
comm.Parameters.Clear()
comm.Parameters.Add("@Name", SqlDbType.VarChar, 50).Value = Me.txtName.Text
comm.Parameters.Add("@Desc", SqlDbType.VarChar, 50).Value = Me.txtDesc.Text
comm.Connection = conn
conn.Open()
Dim afRows As Integer = comm.ExecuteNonQuery()
conn.Close()
If (afRows) Then
MessageBox.Show("Records successfully added. affeced rows = " & afRows)
End If
End Sub
I have another function aLso which display the records when i give a CustomerID.
Records are ennterd and successrully added to the database. It aLso shows the relevan record for the CustomerID.
but after stoping and restart the debugging process, the records are not displayed.
I think the changes are not committed to the database & after closing the program it rollbacks. I dont know whether it is correct or wrong.
Can any one give me a good idea that i can understand weLL please?