Congratulations - C# Corner Q4, 2022 MVPs Announced
Why Join
Become a member
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
C# Corner Home
Technologies
Monthly Leaders
ASK A QUESTION
Forum guidelines
Dinesh Santhalingam
1.4k
737
325.8k
How to insert the data to sql table?
Jan 23 2017 12:32 AM
I have some values .I want to insert the values into the Sql table .Here is my code.There were no error populating.But i can't able to insert the data to sql table.
using (SqlConnection
Connection
=
new
SqlConnection((@"Data Source")))
{
using (SqlCommand
myCommand
=
new
SqlCommand("INSERT INTO table1(Nameofbike,Totalbike,
Inuse)", Connection))
{
Connection.Open();
myCommand.Parameters.Add(new SqlParameter("Nameofbike", "Hero"));
myCommand.Parameters.Add(new SqlParameter("Totalbike", "15"))
myCommand.Parameters.Add(new SqlParameter("Inuse", "10"));
}
Connection.Close();
}
Reply
Answers (
4
)
HOW TO MAKE EACH TEXTBOX PERFORM SUMMATION
How to add Item to a list in c#?