|
|
|
สอบถามหน่อยครับ พอดีจะ insert Date จาก Xtragrid Devexpress ลงในฐานข้อมูล SQL Server |
|
|
|
|
|
|
|
พอดีจะ insert Date จาก Xtragrid Devexpress ลงในฐานข้อมูล SQL Server พอ insert แล้ว รูปแบบจะเป็น 2560 - 2 - 3 คือเอาปี พศ. เข้าไป insert
Code (C#)
private void btnadd_Click(object sender, EventArgs e)
{
string leave_id = "";
string leave_typename = "";
string leave_start = "";
string leave_stop = "";
string leave_sumtime = "";
string employee_ID = "";
try
{
for (int i = 0; i < gridView1.DataRowCount; i++)
{
leave_id = Convert.ToString(gridView1.GetRowCellValue(i, "leave_id"));
leave_typename = Convert.ToString(gridView1.GetRowCellValue(i, "leave_typename"));
leave_start = Convert.ToString(gridView1.GetRowCellValue(i,"leave_start"));
leave_stop = Convert.ToString(gridView1.GetRowCellValue(i, "leave_stop"));
leave_sumtime = Convert.ToString(gridView1.GetRowCellValue(i, "leave_sumtime"));
employee_ID = Convert.ToString(gridView1.GetRowCellValue(i, "employee_ID"));
}
string sqluser = "INSERT INTO tbl_Leave(leave_typename,leave_start,leave_stop,leave_sumtime,employee_ID) VALUES('" + leave_typename + "','" +leave_start+ "','" + leave_stop + "','" + leave_sumtime + "','" + employee_ID + "')";
connect_db.ExcuteData(sqluser);
showdgvmainleave();
MessageBox.Show("บันทึกข้อมูล สำเร็จ !");
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
Tag : .NET, Ms SQL Server 2008, iReport, Win (Windows App), C#, VS 2012 (.NET 4.x)
|
|
|
|
|
|
Date :
2017-03-02 23:01:16 |
By :
kittisak30 |
View :
938 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 05
|