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.2k
Unhandled Exception
Nov 1 2013 9:47 AM
please I'm trying to insert values from a textbox into the database. but I'm having this error when debugging
" No mapping exists from object type System.Windows.Forms.TextBox to a managed provider native type." please help this is my code for the connection
private void SaveBtn1_Click(object sender, EventArgs e)
{
try
{
string connectionString = @"Data Source=JEREMIAH-HP\SQLEXPRESS;Initial Catalog=CgpaCalculator;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(Matric_ID, First_Name, Last_Name, Dept,Level,Cgpa,Entry mode) VALUES (@Matric_ID, @ First_Name, @ Last_Name, @Dept, @Level, @Cgpa, @Entry mode)";
command.Parameters.AddWithValue("@ Matric_ID",matricNo);
command.Parameters.AddWithValue("@First_Name",frstName);
command.Parameters.AddWithValue("@Last_Name", lstName);
command.Parameters.AddWithValue("@Dept",department );
command.Parameters.AddWithValue("@Level",Level );
command.Parameters.AddWithValue("@Cgpa",cgpa);
command.Parameters.AddWithValue("@Entry mode",mdeofentry);
connection.Open();
command.ExecuteNonQuery();
}
}
catch (SqlException ex)
{
MessageBox.Show("There is an Error in saving file" + ex);
}
}
Reply
Answers (
0
)
Regex.IsMatch method
Jump statement