Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21088

Vb sql

$
0
0
I have written this function which should insert a new row into the database table. However it keeps throwing an error at the execute statement. I have used this execute statement for all other inserts within my program. I am not sure if the problem is in the SQL syntax or something i have done wrong.

Can anyone point out what is wrong?

Code:


Dim lvipos As Long
Dim lvsRemAddress
Dim lvsAddress(3) As String
Dim psInsert As String
Dim CallRecBy As String
Dim DateCallRec As String
Dim CallPassedTo As String
Dim CallDetail As String
Dim CompName As String
Dim PostCode As String
Dim telephone As String
Dim mobile As String
Dim AnonCaller As String


CallRecBy = .txtCallsRecBy.Text
DateCallRec = .txtDate.Text
CallPassedTo = .txtCallPassedTo.Text
CallDetail = .txtCallDetails.Text
CompName = .txtName.Text
telephone = .txtTelephone.Text
mobile = .txtMobile.Text
PostCode = .txtPostCode.Text


psInsert = "INSERT INTO complaint(comp_id,date_created,received_by,date_received,passed_to,call_detail,"
psInsert = psInsert & "complaint_name,address_1,address_2,address_3,address_4,post_code,telephone_no,mobile_no,callerKnown)"
psInsert = psInsert & "VALUES(0,'" & psToday & "','" & CallRecBy & "','" & DateCallRec & "','" & CallPassedTo & "','" & CallDetail & "','" & CompName & "','" & Address1 & "','" & Address2 & "','" & Address3 & "','" & Address4 & "','" & PostCode & "','" & telephone & "','" & mobile & "','" & AnonCaller & "')"

dbconn.Execute psInsert




my table

comp_id int serial
date_created date
received_by char(8)
date_received date
passed_to char(8)
call_detail char(200)
complaint_name char(20)
address_1 char(32)
address_2 char(32)
address_3 char(32)
address_4 char(32)
post_code char(10)
telephone_number char(15)
mobile_no(char15)
callerKnown smallint
Date_results_completed date



Thanks

Viewing all articles
Browse latest Browse all 21088

Trending Articles