| Author |
Topic |
|
pickron
Starting Member
6 Posts |
Posted - 2006-05-02 : 15:16:14
|
SQL statement:strInsert = "INSERT Product(ProductCode, ProductTitle, ProductDescription, ProductPrice) VALUES " & _ "(<%#Container.DataItem("ProductCode")%>, <%#Container.DataItem("ProductTitle")%>, <%#Container.DataItem("ProductDescription")%>, <%#Container.DataItem("ProductPrice")%>)" The error states: Compiler Error Message: BC30205: End of statement expected.What is the proper expression for the VALUES to be inserted from container dataitem (look above) ? I tried to put the value from the dataitem into the INSERT command.... doesn't work. Somebody suggest? Thank you! |
|
|
afrika
Master Smack Fu Yak Hacker
2706 Posts |
Posted - 2006-05-02 : 18:27:20
|
| i woudl advice you declare you variables and assign the values first before using them in your SQL statment.What language are you using ? |
 |
|
|
jen
Master Smack Fu Yak Hacker
4110 Posts |
Posted - 2006-05-02 : 21:11:49
|
you should create an sp for this otherwise you are trying to include your parameters + value into the dsql which gives you the errorstrInsert = "INSERT Product(ProductCode, ProductTitle, ProductDescription, ProductPrice) VALUES " & _ "(" & <%#Container.DataItem("ProductCode")%> & ", " & <%#Container.DataItem("ProductTitle")%> & "," & <%#Container.DataItem("ProductDescription")%> & "," & <%#Container.DataItem("ProductPrice")%> & ")"also, before running, print or show strInsert so you'll know you're getting the right string to execute... --------------------keeping it simple... |
 |
|
|
pickron
Starting Member
6 Posts |
Posted - 2006-05-03 : 08:37:51
|
| jen,Thanks for the advice but I still get this error:Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. Compiler Error Message: BC30201: Expression expected.Source Error: Line 33: Line 34: strInsert = "INSERT Product(ProductCode, ProductTitle, ProductDescription, ProductPrice) VALUES " & _Line 35: "(" & <%#Container.DataItem("ProductCode")%> & ", " & <%#Container.DataItem("ProductTitle")%> & "," & <%#Container.DataItem("ProductDescription")%> & "," & <%#Container.DataItem("ProductPrice")%> & ")"Line 36: Line 37: 'strInsert2 = "SELECT * FROM Product WHERE ProductCode = ' " & a & " ' " |
 |
|
|
pickron
Starting Member
6 Posts |
Posted - 2006-05-03 : 08:38:36
|
| afrika,I am running VB.NET and ASP.NET. |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2006-05-03 : 09:28:06
|
enclosed your string value with single quotestrInsert = "INSERT Product(ProductCode, ProductTitle, ProductDescription, ProductPrice) VALUES " & _ "('" & <%#Container.DataItem("ProductCode")%> & "', " KH |
 |
|
|
pickron
Starting Member
6 Posts |
Posted - 2006-05-03 : 10:54:47
|
| KH,Thank you for the advice.It did put the string value into SQL but it is showing the string & <%#Container.DataItem("ProductCode")%> & but NOT the data. I want the data. |
 |
|
|
pickron
Starting Member
6 Posts |
Posted - 2006-05-03 : 11:11:07
|
| strInsert = "INSERT Product(ProductCode, ProductTitle, ProductDescription, ProductPrice) VALUES " & _ "(' " & <%#Container.DataItem(ProductCode)%> & " ' , ' " & <%#Container.DataItem(ProductTitle)%> & " ' , ' " & <%#Container.DataItem(ProductDescription)%> & " ' , ' " & <%#Container.DataItem(ProductPrice)%> & " ')"Now the error shows Expression expected. Show Detailed Compiler Output said the "~" is under < for the <%#Container.DataItem(ProductCode)%>................... |
 |
|
|
pickron
Starting Member
6 Posts |
Posted - 2006-05-04 : 08:16:16
|
| I have fixed it. I changed the parameters into assignment for values. |
 |
|
|
|