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
Durga Velusamy
NA
318
114.4k
windows Application with sql server 2008
Mar 23 2015 2:32 AM
i need example program code which includes windows form and database code.
i want to know how to give if condition with database connectivity. i have code like this
private void button1_Click(object sender, EventArgs e)
{
{
SqlConnection con = new SqlConnection(@"server=CSE-PC; integrated security=true; Database=Bas");
con.Open();
SqlCommand cmd1 = new SqlCommand("insert into devi Values('" + comboBox1.Text + "',+'" + comboBox2
.Text + "','" + comboBox3.Text + "','" + comboBox4.Text + "','" + comboBox5.Text + "','" + comboBox6.Text + "','" + comboBox7.Text + "')", con);
cmd1.ExecuteNonQuery();
hera, i need to give if condition for null. i.e . if box is empty it does not store. it need to show message as MessageBox.Show("doesnot store null value");
con.Close();
MessageBox.Show("Added Successfully");
comboBox1.Text = "";
comboBox2.Text = "";
comboBox3.Text = "";
comboBox4.Text = "";
comboBox5.Text = "";
comboBox6.Text = "";
comboBox7.Text = "";
}
}
how give if condition for this please help me
Reply
Answers (
3
)
How to perform calculation automatically in a gridView
c# windows application