Tech
Forums
Jobs
Books
Events
Live
Interviews
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
1
Reply
Hi...I am trying to solve this error but m not able to.
Deepali Patil
Nov 28 2012 6:17 AM
1k
Reply
This is my code :
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
con.Open();
string cmdstr = "select count(*) from [Registration] where UserName'" + txtUsername.Text + "' ";
SqlCommand cmd = new SqlCommand(cmdstr, con);
int temp = Convert.ToInt32(cmd.ExecuteScalar().ToString()); /
/its giving error on this line.
con.Close();
I am getting this exception :
System.Data.SqlClient.SqlException: Incorrect syntax near 'Deepali'.
when i enter the username as 'Deepali' on login page.
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
1
)
Next Recommended Forum
AutoCompleteExtender with two database fields
Upload Files Asynchronously Using AJAX into SQL Server Database(like gmail).