syntax error with insert statment

Results 1 to 2 of 2

Thread: syntax error with insert statment

  1. #1
    Join Date
    Dec 1969

    Default syntax error with insert statment

    Can someone take a look at this and tell me what the syntax error is?<BR><BR>Dim conInsert as OleDbConnection<BR> Dim strInsert as String<BR> Dim cmdInsert as OleDbCommand<BR> <BR> &#039;retreive count<BR> conInsert = New OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0; DATA SOURCE=C:inetpubwwwrootChimeraDatabaseConversation Log.mdb")<BR> ERROR-----&#062;strInsert = "Insert into Table1 (from, fromCompany, fromPhone, to, toCompany, toPhone, BeginTime, EndTime, CallTime, ConDetail, ProjectName) Values ( @from, @fromCompany, @fromPhone, @to, @toCompany, @toPhone, @BeginTime, @EndTime, @CallTime, @ConDetail, @ProjectName)"<BR> cmdInsert = New OleDbCommand(strInsert, conInsert)<BR> <BR> &#039;Add parameters<BR> cmdInsert.Parameters.Add("@from", txtFrom.text)<BR> cmdInsert.Parameters.Add("@fromCompany", txtFromCompany.text)<BR> cmdInsert.Parameters.Add("@fromPhone", txtFromPhone.text)<BR> cmdInsert.Parameters.Add("@to", txtTo.text)<BR> cmdInsert.Parameters.Add("@toCompany", txtToCompany.text)<BR> cmdInsert.Parameters.Add("@toPhone", txtToPhone.text)<BR> cmdInsert.Parameters.Add("@BeginTime", lblBegin.text)<BR> cmdInsert.Parameters.Add("@EndTime", lblEnd.text)<BR> cmdInsert.Parameters.Add("@CallTime",lblTimer.text )<BR> cmdInsert.Parameters.Add("@ConDetail", txtConvo.text)<BR> cmdInsert.Parameters.Add("@ProjectName",txtProject Name.text)<BR> <BR> conInsert.Open()<BR> cmdInsert.ExecuteNonQuery()<BR> conInsert.Close()

  2. #2
    Join Date
    Dec 1969

    Default RE: syntax error with insert statment

    to is a reserved word in sql so in your SP write [to]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts