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
Fadugba Jeremiah
NA
49
18.1k
Error in saving from windows form to database
Nov 5 2013 5:42 AM
please i'm having error in saving from my windows form using textboxes to my database(sql management studio). when debuging, i have this error at the highlighted line in blue here's the code. thanks
private void button1_Click(object sender, EventArgs e)
{
try
{
string connectionString = @"Data Source=JEREMIAH-HP\SQLEXPRESS;Initial Catalog=CourseInfo;Integrated Security=True";
SqlConnection sqlCon = new SqlConnection(connectionString);
sqlCon.Open();
using (SqlConnection connection = new SqlConnection(connectionString))
using (SqlCommand command = connection.CreateCommand())
{
command.CommandText = "INSERT INTO STUDINFO_TBL(MATRICNO,FIRST_NAME, LAST_NAME, DEPT,LEVEL,CGPA,MODEOFENTRY) VALUES (@MATRICNO, @ FIRST_NAME, @LAST_NAME, @DEPT, @LEVEL, @CGPA, @MODEOFENTRY)";
command.Parameters.AddWithValue("@ MATRICNO",matno);
command.Parameters.AddWithValue("@FIRST_NAME",frstname);
command.Parameters.AddWithValue("@LAST_NAME", lastname);
command.Parameters.AddWithValue("@DEPT",department );
command.Parameters.AddWithValue("@LEVEL",level );
command.Parameters.AddWithValue("@CGPA",mycgpa);
command.Parameters.AddWithValue("@MODEOFENTRY",modeofentry);
connection.Open();
command.ExecuteNonQuery();
}
sqlCon.Close();
}
catch (SqlException ex)
{
MessageBox.Show("There is an Error in saving file" + ex);
}
}
please assist me
Reply
Answers (
1
)
VS.net BASIC
Using Enter Key Instead Of Tab Key In asp.net textBox Contro