 |
|
Code (C#)
string sqlString = "INSERT INTO tb_profile(IdNumber,Name,Surname,EmailAddress,Phone,Sex,DateAdd, Address,District,Prefecture,Province,Zipcode)VALUES(@IdNumber, @Name,@Surname,@EmailAddress,@Phone,@Sex,@DateAdd,@Address,@District,@Prefecture,@Province,@Zipcode)";
SqlCommand comm = new SqlCommand(sqlString);
comm.Connection = objConn;
comm.Parameters.AddWithValue("@IdNumber",TxtIdnumber.Text);
comm.Parameters.AddWithValue("@Name", TxtName.Text);
comm.Parameters.AddWithValue("@Surname", TxtSurname.Text);
comm.Parameters.AddWithValue("@EmailAddress", TxtEmailAddress.Text);
comm.Parameters.AddWithValue("@Phone", TxtPhone.Text);
comm.Parameters.AddWithValue("@Sex", RBLSex.Text);
comm.Parameters.AddWithValue("@DateAdd", TxtDateAdd_CalendarExtender.ClearTime);
comm.Parameters.AddWithValue("@Address", TxtAddress.Text);
comm.Parameters.AddWithValue("@District", TxtDistrict.Text);
comm.Parameters.AddWithValue("@Prefecture", TxtPrefecture.Text);
comm.Parameters.AddWithValue("@Province", TxtProvince.Text);
comm.Parameters.AddWithValue("@Zipcode", TxtZipcode.Text);
เลือกรับค่าวันที่ลงไปแล้ว บันทึกลงฐานข้อมูลได้ แต่ค่าที่แสดงกลายเป็นอีกแบบครับ
ตัวอย่าง
รับค่าวันที่เป็น 21/10/2013 แต่ข้อมูลแสดงเป็น 1/1/1900 12:00:00 AM ครับ
จะแก้ยังไงครับ
Tag : .NET, C#
|
|
 |
 |
 |
 |
Date :
2013-10-21 11:02:30 |
By :
sompor |
View :
821 |
Reply :
3 |
|
 |
 |
 |
 |
|
|
|
 |