TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Shiva Tiwari
NA
73
5.2k
cmd.ExecuteScalar() is not returning value
Jun 13 2020 3:02 AM
Recored is inserting but cmd.ExecuteScalar() is not returning any value
string query = "Insert into customer(FirstName,LastName,Email,Contact,House,street,colony,city,state,country,Added_on) values(@FirstName,@LastName,@Email,@Contact,@House,@street,@colony,@city,@state,@country,@Added_on)";
SqlCommand cmd = new SqlCommand(query, EcomConString);
cmd.Parameters.AddWithValue("@FirstName", SqlDbType.VarChar).Value = txtFirstName.Text;
cmd.Parameters.AddWithValue("@LastName", SqlDbType.VarChar).Value = txtLastName.Text;
cmd.Parameters.AddWithValue("@Email", SqlDbType.VarChar).Value = txtEmail.Text;
cmd.Parameters.AddWithValue("@Contact", SqlDbType.VarChar).Value = txtContact.Text;
cmd.Parameters.AddWithValue("@House", SqlDbType.VarChar).Value = "";
cmd.Parameters.AddWithValue("@street", SqlDbType.VarChar).Value = "";
cmd.Parameters.AddWithValue("@colony", SqlDbType.VarChar).Value = "";
cmd.Parameters.AddWithValue("@city", SqlDbType.VarChar).Value = "";
cmd.Parameters.AddWithValue("@state", SqlDbType.VarChar).Value = "";
cmd.Parameters.AddWithValue("@country", SqlDbType.VarChar).Value = txtCountry.Text;
cmd.Parameters.AddWithValue("@Added_on", SqlDbType.VarChar).Value = DateTime.Now.ToString("MMM dd yyyy");
EcomConString.Open();
exec=Convert.ToInt32(cmd.ExecuteScalar());
EcomConString.Close();
Reply
Answers (
2
)
System.MissingMethodException: Method not found
how to send ajax