473,322 Members | 1,409 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Incorrect syntax near '*'

Hallo zusammen,
I have an app. with SQL-Server. The same page worked fine with Access-DB.
Now I have a problem with this command:

Dim strSQL As String

Dim myConnection As New
SqlConnection("server=mssql07.1und1.de;uid=dbo8888 8888;pwd=8888888;database=db88888888")

myConnection.Open()

strSQL = "delete * from tbl1 where id =" & n

Dim myCommand As New SqlCommand(strSQL, myConnection)

myCommand.ExecuteNonQuery()

myConnection.Close()

if I try to perform the command I get this message:

Incorrect syntax near '*'

What is the right syntax?
Thank you!
Mario


Jan 27 '07 #1
5 4220
Howdy,

SQL server does not understand * in delete statement.
strSQL = "delete from tbl1 where id =" & n

--
Milosz
"Mario Krsnic" wrote:
Hallo zusammen,
I have an app. with SQL-Server. The same page worked fine with Access-DB.
Now I have a problem with this command:

Dim strSQL As String

Dim myConnection As New
SqlConnection("server=mssql07.1und1.de;uid=dbo8888 8888;pwd=8888888;database=db88888888")

myConnection.Open()

strSQL = "delete * from tbl1 where id =" & n

Dim myCommand As New SqlCommand(strSQL, myConnection)

myCommand.ExecuteNonQuery()

myConnection.Close()

if I try to perform the command I get this message:

Incorrect syntax near '*'

What is the right syntax?
Thank you!
Mario


Jan 27 '07 #2
"Mario Krsnic" <krsnic.de/fe******@remove.comwrote in message
news:ep**********@online.de...
strSQL = "delete * from tbl1 where id =" & n
Remove the asterisk.
Jan 27 '07 #3
Thank you!

"Mark Rae" <ma**@markNOSPAMrae.comschrieb im Newsbeitrag
news:uE**************@TK2MSFTNGP04.phx.gbl...
"Mario Krsnic" <krsnic.de/fe******@remove.comwrote in message
news:ep**********@online.de...
>strSQL = "delete * from tbl1 where id =" & n

Remove the asterisk.

Jan 27 '07 #4
Try the percentage sign ( % ).
strSQL = "delete % from tbl1 where id =" & n
The asterisk ( * ) only works in Access databases.

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"Mario Krsnic" <krsnic.de/fe******@remove.comwrote in message news:ep**********@online.de...
Hallo zusammen,
I have an app. with SQL-Server. The same page worked fine with Access-DB. Now I have a problem
with this command:

Dim strSQL As String

Dim myConnection As New
SqlConnection("server=mssql07.1und1.de;uid=dbo8888 8888;pwd=8888888;database=db88888888")

myConnection.Open()

strSQL = "delete * from tbl1 where id =" & n

Dim myCommand As New SqlCommand(strSQL, myConnection)

myCommand.ExecuteNonQuery()

myConnection.Close()

if I try to perform the command I get this message:

Incorrect syntax near '*'

What is the right syntax?
Thank you!
Mario


Jan 27 '07 #5
Please ignore this comment:
Try the percentage sign ( % ).
>strSQL = "delete % from tbl1 where id =" & n
The correct statement is :
strSQL = "delete from tbl1 where id =" & n
The percentage sign works with the LIKE statement.


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"Juan T. Llibre" <no***********@nowhere.comwrote in message
news:ed**************@TK2MSFTNGP03.phx.gbl...
The asterisk ( * ) only works in Access databases.
Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"Mario Krsnic" <krsnic.de/fe******@remove.comwrote in message news:ep**********@online.de...
>Hallo zusammen,
I have an app. with SQL-Server. The same page worked fine with Access-DB. Now I have a problem
with this command:

Dim strSQL As String

Dim myConnection As New
SqlConnection("server=mssql07.1und1.de;uid=dbo888 88888;pwd=8888888;database=db88888888")

myConnection.Open()

strSQL = "delete * from tbl1 where id =" & n

Dim myCommand As New SqlCommand(strSQL, myConnection)

myCommand.ExecuteNonQuery()

myConnection.Close()

if I try to perform the command I get this message:

Incorrect syntax near '*'

What is the right syntax?
Thank you!
Mario



Jan 27 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Jeff Magouirk | last post by:
Dear Group, I am trying to create a view and keep getting the Incorrect syntax near the keyword 'Declare'" error. Here is the code I am writing. Create view fixed_airs (sid, fad_a2, fad_a3)...
4
by: Carl | last post by:
Can you tell me what is wrong with this syntax ? string select = "UPDATE .. " + "(,,,,,,, ,,,, ,,, , , , ) " + " VALUES (@id,@clientid,@total,@tps,@tvq,@gtotal,@datefac,@datepay,
1
by: Zoury | last post by:
Hi there! :O) I trying to use a COM DLL (made in VB 6.0) from C#... and it hasn't been working well for me this far.. :O/ I did a sample in VB 6.0 that used the DLL and it works great.. so now...
2
by: JMUApache | last post by:
Hi, I have got a error message while I run a sample OLEDB program. It says "Incorrect Syntax Near The Keyword Default Information". platform: Windows XP + Visual Studio 2005 Beta 2 + SQL...
1
by: Sandesh | last post by:
Hello All, Me saying " has any body come across such error would be underestimating". Well I am getting a very peculiar and unique error "Line 1: Incorrect syntax near 'Actions'." ...
1
by: iporter | last post by:
In the following code, the two Response.Write statements output exactly the same - I can copy and paste both into Query Analyzer, and run them fine. However, if I comment out line 3, the...
3
by: wallic | last post by:
Hello, This is my first post and I am a beginner with SQL code. The code below is supposed to update a new table (loctable) with a calculated value based on the original table (hra_data). ...
0
by: roamnet | last post by:
hi i created database file with .mdf extention ,sql server as a source and use grid view to display data there're no problem in data retrieve and display,but i want to edit it or insert new...
10
by: arial | last post by:
Hi, I am getting this error message: Incorrect syntax near the keyword 'where'. Description: An unhandled exception occurred during the execution of the current web request. Please review...
1
by: karenkksh | last post by:
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.