B
Brent Howard
Hi everyone,
I want to get the body of a new e-mail and insert the information into
an sql database.
I have managed to get the required information from the message body and
split the information into fields. The problem I have is when the program
gets to cmdInsert.ExecuteNonQuery It stops and doesn't give an error. If i
run the exact same code in another windows base form it works no worrys.
any ideas?
Thanks Brent.
Dim strInsert As String = "INSERT INTO " & str_Table & "(" &
str_TargetFromField & ", " & _
str_TargetReceivedField & ", " & _
str_TargetMsgField & ")" & _
" VALUES ('" & str_From & "','" & _
str_Received & "','" & _
str_msg & "')"
Dim conn As New SqlClient.SqlConnection()
conn.ConnectionString = "Server=" & str_Server & "; Database=" &
str_Database & "; user ID=" & str_UserID & "; password=" & str_Password
conn.Open()
Dim cmdInsert As New SqlClient.SqlCommand(strInsert, conn)
If cmdInsert.ExecuteNonQuery = 1 Then
MsgBox("SQL Update Succeeded")
Else
MsgBox("SQL Update Failed")
End If
conn.Close()
I want to get the body of a new e-mail and insert the information into
an sql database.
I have managed to get the required information from the message body and
split the information into fields. The problem I have is when the program
gets to cmdInsert.ExecuteNonQuery It stops and doesn't give an error. If i
run the exact same code in another windows base form it works no worrys.
any ideas?
Thanks Brent.
Dim strInsert As String = "INSERT INTO " & str_Table & "(" &
str_TargetFromField & ", " & _
str_TargetReceivedField & ", " & _
str_TargetMsgField & ")" & _
" VALUES ('" & str_From & "','" & _
str_Received & "','" & _
str_msg & "')"
Dim conn As New SqlClient.SqlConnection()
conn.ConnectionString = "Server=" & str_Server & "; Database=" &
str_Database & "; user ID=" & str_UserID & "; password=" & str_Password
conn.Open()
Dim cmdInsert As New SqlClient.SqlCommand(strInsert, conn)
If cmdInsert.ExecuteNonQuery = 1 Then
MsgBox("SQL Update Succeeded")
Else
MsgBox("SQL Update Failed")
End If
conn.Close()