|
 |
|
มีปัญหาในกับ datetime ในฐานข้อมูล access และการแปลงเพื่อ datetime เพื่อบันทึกข้อมูล |
|
 |
|
|
 |
 |
|
ภาษา c# datebase acess2010
มีปัญหากับ datetime ครับ
ผมทำโปรเจคเว็ปจองสนามฟุตบอลออนไลน์ และการจัดการส่วนอื่นๆ
จะขอถามในส่วนของ type ในดาต้าเบส
1. ผมสับสนว่า ใน ดาต้าเบส bdatetime , bookdate ผมเก็บเป็น datetime shordate
และ TIME_ID เป็น datetime shorttime แต่พอผมโชว์ข้อมูล ในbookdate ,bdatetime มันมี เวลามาให้ด้วยและใน TIME_ID
ดันมีวันที่มาให้ผมด้วย ไม่ทราบว่าจะแก้ไขอย่างไรบ้าง

Code
string cmdStr = "INSERT INTO Booking"
+ " (BDATETIME,BOOKDATE,TIME_ID,USER,STA_ID,SOC_ID)"
+ "VALUES (" + DateTime.Today.ToShortDateString() + " , " +
Convert.ToDateTime(lbDatetime.Text) + " , '" +
lbBooktime.Text + "' , '" +
lbUser.Text + "' , '1' , '" +
lbBooksocfield.Text + "')";
OleDbCommand cmd1 = new OleDbCommand(cmdStr, con1);
cmd1.ExecuteNonQuery();
con1.Close();
2.จากโค้ดด้านบนที่ผมมีปัญหากับดาต้าเบส ผมเลยต้องการแปลง คอลัมที่เป็นdatetime เพื่อ insert ลงฐานข้อมูลแต่ไม่สามารถทำได้
ผมคิดว่า น่าจะผิดที่ ' " หรือไม่ก็ วิธีการแปลง datetime เพื่อบันทึกข้อมูลลงฐานข้อมูล
แก้ไขอย่างไรได้บ้าง
นี้เป็นปัญหาเบื้องต้นที่ผมกำลังแก้ไข ผมอยากได้คำแนะนำจากพี่ๆ
ถ้ามีผู้ใดว่างๆ สามารถให้ผมปรึกษาได้ผมอยากขอเมล์ไว้ติดต่อด้วยคับ โปรเจคใกล้ส่งแล้ว T_T สิ้นเดือน ขอบคุณล่วงหน้าครับ
Tag : .NET, Web (ASP.NET), C#, VS 2010 (.NET 4.x)

|
|
 |
 |
 |
 |
Date :
2012-05-06 23:50:29 |
By :
nut0202 |
View :
1301 |
Reply :
1 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (Web.Config)
<configuration>
<system.web>
<globalization
culture="th-TH"
uiCulture="th-TH"
/>
</system.web>
</configuration>
ลองดูพวก culture ครับ ในกระทู้เก่า ๆ ก็มีอยู่หลายตัวอย่าง
|
 |
 |
 |
 |
Date :
2012-05-07 06:53:58 |
By :
mr.win |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 03
|