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
Jyoti Jodha
NA
1.7k
406.9k
The variable name '@logo' has already been declared. c#
Sep 6 2017 3:05 AM
The variable name '@logo' has already been declared. Variable names must be unique within a query batch or stored procedure. in windows form c#
cmd =
new
SqlCommand(
"insert into cmpny_dtl(c_name,adrs,c_phone,,logo ,state_id ) values(@c_name,@adrs,@c_phone,@state_id )"
, con);
con.Open();
cmd.Parameters.AddWithValue(
"@c_name"
, CmpnyName_txt.Text);
cmd.Parameters.AddWithValue(
"@adrs"
, Adrs_txt.Text);
cmd.Parameters.AddWithValue(
"@c_phone"
, CmpnyPhone_txt.Text);
cmd.Parameters.AddWithValue(
"@logo"
,
"@logo"
);
cmd.Parameters.AddWithValue(
"@state_id"
, STATE_comboBox.SelectedValue);
if
(pictureBox1.Image !=
null
)
{
MemoryStream ms =
new
MemoryStream();
pictureBox1.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
byte
[] photo = ms.ToArray();
cmd.Parameters.AddWithValue(
"@logo"
, photo);
}
else
{
cmd.Parameters.AddWithValue(
"@logo"
, (pictureBox1.Image ==
null
) ? (
object
)DBNull.Value : pictureBox1.Image).SqlDbType = SqlDbType.Image;
}
int
k = cmd.ExecuteNonQuery();
cmd.ExecuteNonQuery();
con.Close();
MessageBox.Show(
"Record Inserted Successfully"
);
Reply
Answers (
3
)
Browser URL Encryption and Decryption
Textbox validation for amount