M
Michael Persaud
Hello,
I am trying to insert into a SQL2000 dbase some records
i am havinf some difficulty with the code below:
Dim Reports
If CboReportsTo.Text.ToString > "" Then
Reports = CboReportsTo.Text.ToString
Else
Reports = ""
End If
Dim str As String = "insert into Jobtitle(JobTitle,JobDescription,ReportsTo)
values('" _
& txtTitle.Text & "','" & txtDescription.Text & "','" & Reports & "')"
MsgBox(str)
Dim sqlcom As New SqlCommand(str, sqlcon)
'sqlcom.CommandText = str
sqlcon.Open()
sqlcom.ExecuteNonQuery() ' this line
sqlcon.Close()
I set a connection string as follows in the class of the vb form;
Dim strC As String = "integrated security=sspi;Data source=to-is1;initial
catalog=HRO"
Dim sqlcon As SqlConnection = New SqlConnection(strC)
I cant get the record inserted; sqlexception, system error
thanks
Michael
I am trying to insert into a SQL2000 dbase some records
i am havinf some difficulty with the code below:
Dim Reports
If CboReportsTo.Text.ToString > "" Then
Reports = CboReportsTo.Text.ToString
Else
Reports = ""
End If
Dim str As String = "insert into Jobtitle(JobTitle,JobDescription,ReportsTo)
values('" _
& txtTitle.Text & "','" & txtDescription.Text & "','" & Reports & "')"
MsgBox(str)
Dim sqlcom As New SqlCommand(str, sqlcon)
'sqlcom.CommandText = str
sqlcon.Open()
sqlcom.ExecuteNonQuery() ' this line
sqlcon.Close()
I set a connection string as follows in the class of the vb form;
Dim strC As String = "integrated security=sspi;Data source=to-is1;initial
catalog=HRO"
Dim sqlcon As SqlConnection = New SqlConnection(strC)
I cant get the record inserted; sqlexception, system error
thanks
Michael