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
narasiman rao
NA
519
768.5k
When i run error occurs
Oct 25 2012 8:02 AM
i design the following application as follows;
Name txt_name
Employeeid Textbox2
Dept checkboxlist1
checkboxlist2
Gender Radiobuttionlist1
Radiobuttionlist2
DOB dropdown
Mobileno txt_mobile
email txt_emailid
Address txt_address
I have one insert button.
con = new SqlConnection("Server=(local);initial catalog=master;Trusted_Connection=True");
con.Open();
SqlCommand cmd = new SqlCommand("Reg", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add(new SqlParameter("@Empid", TextBox2.Text));
cmd.Parameters.Add(new SqlParameter("@Name", txt_name.Text));
cmd.Parameters.Add(new SqlParameter("@Dept", CheckBoxList1.Text));
cmd.Parameters.Add(new SqlParameter("@Gender", RadioButtonList1.Text));
cmd.Parameters.Add(new SqlParameter("@DOB", Calendar1.TodaysDate));
cmd.Parameters.Add(new SqlParameter("@Mobile", txt_mobile.Text));
cmd.Parameters.Add(new SqlParameter("@Email", txt_emailid.Text));
cmd.Parameters.Add(new SqlParameter("@Address", txt_address.Text));
cmd.ExecuteNonQuery();
con.Close();
Creating Store Procedure code as follows
CREATE Procedure Reg
@Name varchar(50),
@Empid varchar(50),
@Dept varchar(50),
@Gender varchar(50),
@DOB varchar(50),
@Mobile int,
@Email Varchar(50),
@Address Varchar(50)
AS
BEGIN
INSERT INTO Registration VALUES(@Name,@Empid,@Dept,@Gender,@DOB,@Mobile,@Email,@Address)
END
GO
Database table design as follows;
Name
varchar
Empid varchar
Dept varchar
Gender varchar
DOB varchar
Mobile int
Email varchar
Address varchar
WHEN I RUN FOLLOWING ERROR OCCURS AS FOLLOWS;
Error converting data type nvarchar to int.
Reply
Answers (
5
)
Problem creating .NET COM object from C++ application.
Checkbox in unbound datagridview (windows app)