•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP.NET section within the Web Development category of DaniWeb, a massive community of 430,001 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,505 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting
Views: 400 | Replies: 3
![]() |
•
•
Join Date: May 2006
Posts: 32
Reputation:
Rep Power: 3
Solved Threads: 0
this the the code for inserting data in a database
the error
Syntax error in INSERT INTO statement.
Line 106: cmd.Connection = cn
Line 107: cmd.CommandText = SQLTxt
Line 108: cmd.ExecuteNonQuery()
Line 109: cmd.Connection.Close()
Dim cn As New Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & Server.MapPath("database.mdb"))
cn.Open()
Dim cmdr As New Data.OleDb.OleDbCommand
cmdr.CommandText = "SELECT [Customer_ID] FROM [Customers] WHERE FirstName LIKE '" & User.Identity.Name & "'"
Dim id As Integer
cmdr.Connection = cn
id = System.Convert.ToInt32(cmdr.ExecuteScalar())
Dim cmd As Data.OleDb.OleDbCommand = New Data.OleDb.OleDbCommand
Dim SQLTxt As String = "INSERT INTO Orders (Customer_ID,Total_price,Delivery,Ordered time)VALUES( '" & id & "','" & lblTotal.Text & "','" & CheckBox1.Checked & "','" & DateTime.Now() & "')"
cmd.Connection = cn
cmd.CommandText = SQLTxt
cmd.ExecuteNonQuery()
cmd.Connection.Close()the error
Syntax error in INSERT INTO statement.
Line 106: cmd.Connection = cn
Line 107: cmd.CommandText = SQLTxt
Line 108: cmd.ExecuteNonQuery()
Line 109: cmd.Connection.Close()
![]() |
•
•
•
•
•
•
•
•
DaniWeb ASP.NET Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
access advice age amd avatar backup blue gene chips code combo daniweb data data protection database dos dropdownlist economy encryption europe forensic forensics hardware help ibm ibm. news intel ibm it linux medicine memory microsoft module net news openoffice pc privacy ps3 recession red hat reuse russia security server storage supercomputing technology trends web working
- Shopping Cart Not Working (ASP.NET)
- MySQL syntax error 1064 (MySQL)
- Scalar variable Error (ASP.NET)
- memory management in wndows 2000 (Windows NT / 2000 / XP / 2003)
- Syntax error in INSERT INTO statement (Java)
- Help! Parse error: parse error, unexpected T_STRING (PHP)
- Understanding ASP classes (ASP Tutorials)
Other Threads in the ASP.NET Forum
- Previous Thread: Must declare the scalar variable ERROR
- Next Thread: [LINQ, C#]Problem with autogenerated DataClasses.designer.cs


Linear Mode