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
ancy chacko
NA
71
18.5k
inserting data into database
Feb 2 2015 5:08 AM
i am didnt get the correct output ....there is no error ....any one check my coding
MySqlDataAdapter da = new MySqlDataAdapter("select * from leavefomm where empcode = '" + TextBox1.Text + "'", cn);
DataTable dt = new DataTable();
DataSet ds = new DataSet();
da.Fill(ds);
foreach (DataRow dr in ds.Tables[0].Rows)
{
//Convert.ToInt32
Double col1Value = 0;
Double col2Value = 0;
if (!Convert.IsDBNull(dr["Leavebal"]))
{
col1Value = (Double)dr["Leavebal"];
Label3.Text = col1Value.ToString();
}
if (!Convert.IsDBNull(dr["Number"]))
{
col2Value = (Double)dr["Number"];
Label1.Text= col2Value.ToString();
}
if (col1Value <= col2Value)
{
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert(' ...... ')", true);
}
else
{
cn.Open();
string str3 = "insert into leavefomm values('" + dplsttype.SelectedItem.Text + "','" + TextBox1.Text + "','" + Label4.Text + "','" + Label3.Text + "','" + txtfrom.Text + "', '" + dpleavefrom.SelectedItem.Text + "','" + txtto.Text + "','" + dpleaveto.SelectedItem.Text + "','" + Label1.Text + "','" + txtremark.Text + "')";
MySqlCommand Cmd = new MySqlCommand(str3, cn);
Cmd.ExecuteNonQuery();
cn.Close();
}
}
Reply
Answers (
3
)
how to put action link in grid view in mvc4 application
Challanging Exercise Checkboxlist item