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
Mohammad Rashed Obaidat
NA
8
2.7k
Insert Data into SQL DataBase
Feb 7 2012 8:50 AM
Dear all,
I try to insert data into my Database but when I click the button nothing happen I tried to use select statement instead of insert statement and it works well, but when I try ti update or insert data nothing happens, could anybody help me with that?
This is the code:
SqlConnection
con =
new SqlConnection()
;
SqlCommand
cmd =
new SqlCommand()
;
con.ConnectionString = @"Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\nobel.mdf;Integrated Security=True;User Instance=True";
con.Open();
cmd.CommandText = "INSERT INTO test VALUES (@amount, @description)";
cmd.Parameters.AddWithValue("@amount", Convert.ToInt64(txt_amount.Text));
cmd.Parameters.AddWithValue("@description", rtxt_description.Text);
cmd.Connection = con;
cmd.ExecuteNonQuery();
con.Close();
Reply
Answers (
8
)
The class name '?' is not a valid identifier for this language.
Get deterministic finalization in C#?