473,383 Members | 1,863 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,383 software developers and data experts.

[SqlException: Line 1: Incorrect syntax near '*'.]

I am trying to initialize a dataReader in C#, but I keep on gettin an
exception error stating the following:

[SqlException: Line 1: Incorrect syntax near '*'.]
System.Data.SqlClient.SqlCommand.ExecuteReader(Com mandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream)
System.Data.SqlClient.SqlCommand.ExecuteReader()
Labor.Labor.Page_Load(Object sender, EventArgs e) in
c:\inetpub\wwwroot\labor\labor.aspx.cs:72
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()
My code is the following:

// SQL Connection
sqlConnect = new SqlConnection("Data Source=" + server +";Initial
Catalog=" + database +";User ID=" + uid +";Password=" + password);

sqlConnect.Open();

sql="";
sql="SELCT * FROM tOrder";
SqlCommand sqlCmd = new SqlCommand( sql,sqlConnect);

System.Data.SqlClient.SqlDataReader reader = sqlCmd.ExecuteReader();
I checked the connection state and it is equal to "Open" so apparenlty
the connection to the DB was made. But I can not create a reader to
read the table.

Please help.

Thank you,
Behzad
Nov 16 '05 #1
1 3355
You spelled 'SELECT' as 'SELCT'.

"bdastani" <bd******@gmail.com> wrote in message
news:69**************************@posting.google.c om...
I am trying to initialize a dataReader in C#, but I keep on gettin an
exception error stating the following:

[SqlException: Line 1: Incorrect syntax near '*'.]
System.Data.SqlClient.SqlCommand.ExecuteReader(Com mandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream)
System.Data.SqlClient.SqlCommand.ExecuteReader()
Labor.Labor.Page_Load(Object sender, EventArgs e) in
c:\inetpub\wwwroot\labor\labor.aspx.cs:72
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()
My code is the following:

// SQL Connection
sqlConnect = new SqlConnection("Data Source=" + server +";Initial
Catalog=" + database +";User ID=" + uid +";Password=" + password);

sqlConnect.Open();

sql="";
sql="SELCT * FROM tOrder";
SqlCommand sqlCmd = new SqlCommand( sql,sqlConnect);

System.Data.SqlClient.SqlDataReader reader = sqlCmd.ExecuteReader();
I checked the connection state and it is equal to "Open" so apparenlty
the connection to the DB was made. But I can not create a reader to
read the table.

Please help.

Thank you,
Behzad

Nov 16 '05 #2

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

Similar topics

2
by: Roger R. Smith | last post by:
I see this error in my ASP .NET code: I am trying to execute the following: private const string SQL_SELECT_USER = "SELECT User.Email, User.FirstName, User.LastName, User.Status, User.Phone,...
2
by: Patrick.O.Ige | last post by:
Can anybody body tell me what my error is here its saying :- System.Data.SqlClient.SqlException: Incorrect syntax near the keyword 'WHERE'. SQLString = "UPDATE treetable SET " & _ "ParentID =...
3
by: Patrick.O.Ige | last post by:
Hi guys, I'm getting error:- System.Data.SqlClient.SqlException: Line 1: Incorrect syntax near '='. What could cause this ERRORR My code below:- Dim connString As String =...
4
by: Patrick Olurotimi Ige | last post by:
why is this giving me error System.Data.SqlClient.SqlException: Line 1: Incorrect syntax near '='.?? my code is in c# strSql = "Update addmessage Set message = '"+null+"' Where ID=" +ID; ...
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'." ...
6
by: martin1 | last post by:
I just use DataSet to bind DataSetGrid and display from SQL DB. when starting run in Visual Studio 2005, get "Line 1: Incorrect syntax near '1'" error message from below fill line, ...
1
by: harleedavidson | last post by:
Using SqlBulkCopy.WriteToServer to upload a datatable and getting: System.Data.SqlClient.SqlException Line 1: Incorrect syntax near 'COLLATE'. Database Server is SQL2000, database in in 6.5...
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...
1
by: Ruth413 | last post by:
Hello - I am getting the these errors in my sql 2005 generated script. I am stuck with first error. Please help.... Msg 102, Level 15, State 1, Line 3 Incorrect syntax near '('. Msg 319,...
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...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.