A
Angelina
ok im almost near completing this........thx u all for
helping me out and being patient with me )
I have written this code for an onclick event of a button
so that i can run a stored procedure i created in access.
The SPROC performs an insert of 2 values into a table.
hereis my code:
Private Sub Button1_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Button1.Click
Dim Cn As New SqlConnection("initial
catalog=TestCaraDBmsde;integrated security=SSPI;persist
security info=False;workstation id=USER;packet size=4096")
Dim cmd As New SqlCommand("SPInsMeal", Cn)
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.Add( _
New SqlParameter("@Meal_desc",
SqlDbType.Char, 50)).Value = txtMealdesc.Text
cmd.Parameters.Add(New SqlParameter("@Cost",
SqlDbType.Money))
Try
Cn.Open()
cmd.ExecuteNonQuery()
Finally
Cn.Close()
End Try
I keep getting errors when i try and run this. It seems
to stop at the cmd.ExecuteNonQuery() line.
What am i doin wrong?
any help is appreciated. )
helping me out and being patient with me )
I have written this code for an onclick event of a button
so that i can run a stored procedure i created in access.
The SPROC performs an insert of 2 values into a table.
hereis my code:
Private Sub Button1_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Button1.Click
Dim Cn As New SqlConnection("initial
catalog=TestCaraDBmsde;integrated security=SSPI;persist
security info=False;workstation id=USER;packet size=4096")
Dim cmd As New SqlCommand("SPInsMeal", Cn)
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.Add( _
New SqlParameter("@Meal_desc",
SqlDbType.Char, 50)).Value = txtMealdesc.Text
cmd.Parameters.Add(New SqlParameter("@Cost",
SqlDbType.Money))
Try
Cn.Open()
cmd.ExecuteNonQuery()
Finally
Cn.Close()
End Try
I keep getting errors when i try and run this. It seems
to stop at the cmd.ExecuteNonQuery() line.
What am i doin wrong?
any help is appreciated. )