A
Anburose
Guest
Private Sub CmdSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmdSave.Click
Call Sqlconn.Main()
Dim objcn As New SqlConnection(cnn)
Dim objcmd = New SqlCommand
Dim s As String
objcmd.Connection = objcn
Try
objcn.Open()
If OptDept.Checked Then
objcmd.CommandText ="insert into department(deptcode,department)values(@dcode,@dName)"
Else
objcmd.CommandText = "insert into designation(desigcode,designame)values(@dcode,@dName)"
End If
objcmd.Parameters.AddWithValue("@dcode", Trim(TextBox1.Text))
objcmd.Parameters.AddWithValue("@dname", Trim(TextBox2.Text))
objcmd.ExecuteNonQuery()
objcn.Close()
MsgBox("1 Record Added Successfully")
Call CmdClear_Click(sender, e)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
This my codeing.
?objcmd.commendtext then it display insert into department(deptcode,department)values(@dcode,@dName) in immediate window.
i want "Insert into department (deptcode,department) values(1,'IT').
what can id do? help me anybody
Continue reading...
Call Sqlconn.Main()
Dim objcn As New SqlConnection(cnn)
Dim objcmd = New SqlCommand
Dim s As String
objcmd.Connection = objcn
Try
objcn.Open()
If OptDept.Checked Then
objcmd.CommandText ="insert into department(deptcode,department)values(@dcode,@dName)"
Else
objcmd.CommandText = "insert into designation(desigcode,designame)values(@dcode,@dName)"
End If
objcmd.Parameters.AddWithValue("@dcode", Trim(TextBox1.Text))
objcmd.Parameters.AddWithValue("@dname", Trim(TextBox2.Text))
objcmd.ExecuteNonQuery()
objcn.Close()
MsgBox("1 Record Added Successfully")
Call CmdClear_Click(sender, e)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
This my codeing.
?objcmd.commendtext then it display insert into department(deptcode,department)values(@dcode,@dName) in immediate window.
i want "Insert into department (deptcode,department) values(1,'IT').
what can id do? help me anybody
Continue reading...