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
Erdinc Kolukisa
NA
113
0
sending parameters to Stored Procedure from Form
Oct 5 2010 9:31 AM
hey guys..i am trying to add records to my db...i created stored procedure and it works...but although it can add the datas it show message box and failed because of the if situation i think..but i didnt understand where is my mistake
try
{
con =
new
SqlConnection
(
"data source=Erdinc;initial catalog=deneme;integrated security=true"
);
cmd =
new
SqlCommand
(
"sp_TablolaraEkle"
, con);
con.Open();
cmd.CommandType =
CommandType
.StoredProcedure;
cmd.Parameters.Add(
"@marka_ad"
, System.Data.
SqlDbType
.NVarChar, 50).Value = textBox1.Text;
cmd.Parameters.Add(
"@model_ad"
, System.Data.
SqlDbType
.NVarChar, 50).Value = textBox2.Text;
int
rows = cmd.ExecuteNonQuery();
if
(rows == 1)
MessageBox
.Show(
"Succeed"
,
"Warning"
,
MessageBoxButtons
.OK,
MessageBoxIcon
.Information);
else
MessageBox
.Show(
"Failed"
,
"Warning"
,
MessageBoxButtons
.OK,
MessageBoxIcon
.Information);
}
catch
(
Exception
ex)
{
MessageBox
.Show(ex.Message,
"Warning"
,
MessageBoxButtons
.OK,
MessageBoxIcon
.Error);
}
finally
{
con.Close();
}
Reply
Answers (
2
)
Developing billing software for hotel using asp.net
some intreasting problem here......