|
|
|
Insert, Delete,Update ใน sqlce แต่มันไม่ลงฐานข้อมูลค่ะ. |
|
|
|
|
|
|
|
คือ...อยากช่วยน่ะค่ะ
แต่...ไม่มีตัวอย่างโค้ด
หรือไม่ก็ รายละเอียด เพิ่มให้หน่อยจ้า
|
|
|
|
|
Date :
2011-04-20 15:57:12 |
By :
mayapopy |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
รันที่ไหนครับลอง Capture หน้าจอมาให้ดูด้วยน่ะครับ
|
|
|
|
|
Date :
2011-04-20 16:02:04 |
By :
webmaster |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void Add_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(this.textBox1.Text))
{
MessageBox.Show("Please input (wth)");
this.textBox1.Focus();
return;
}
if (string.IsNullOrEmpty(this.textBox2.Text))
{
MessageBox.Show("Please input (weng)");
this.textBox2.Focus();
return;
}
SqlCeConnection myConnection = default(SqlCeConnection);
myConnection = new SqlCeConnection("Data Source =" + (System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase) + "\\dtb1.sdf;"));
myConnection.Open();
SqlCeCommand myCommand = myConnection.CreateCommand();
myCommand.CommandText = "INSERT INTO [vocab] ([wth], [weng]) VALUES " + " ('" + this.textBox1.Text + "','" + this.textBox2.Text + "' ) ";
myCommand.CommandType = CommandType.Text;
myCommand.ExecuteNonQuery();
myConnection.Close();
MessageBox.Show("Save Successfully");
frmHome f = new frmHome();
f.Show();
}
|
|
|
|
|
Date :
2011-04-20 16:22:40 |
By :
nan |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Date :
2011-04-20 16:35:09 |
By :
nan |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void Add_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(this.textBox1.Text))
{
MessageBox.Show("Please input (wth)");
this.textBox1.Focus();
return;
}
if (string.IsNullOrEmpty(this.textBox2.Text))
{
MessageBox.Show("Please input (weng)");
this.textBox2.Focus();
return;
}
SqlCeConnection myConnection = default(SqlCeConnection);
myConnection = new SqlCeConnection("Data Source =" + (System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase) + "\\dtb1.sdf;"));
myConnection.Open();
SqlCeCommand myCommand = myConnection.CreateCommand();
myCommand.CommandText = "INSERT INTO [vocab] ([wth], [weng]) VALUES " + " ('" + this.textBox1.Text + "','" + this.textBox2.Text + "' ) ";
myCommand.CommandType = CommandType.Text;
myCommand.ExecuteNonQuery();
myConnection.Close();
MessageBox.Show("Save Successfully");
frmHome f = new frmHome();
f.Show();
}Code (C#)
|
|
|
|
|
Date :
2011-04-20 16:35:56 |
By :
nan |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (C#)
private void Add_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(this.textBox1.Text))
{
MessageBox.Show("Please input (wth)");
this.textBox1.Focus();
return;
}
if (string.IsNullOrEmpty(this.textBox2.Text))
{
MessageBox.Show("Please input (weng)");
this.textBox2.Focus();
return;
}
SqlCeConnection myConnection = default(SqlCeConnection);
myConnection = new SqlCeConnection("Data Source =" + (System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase) + "\\dtb1.sdf;"));
myConnection.Open();
SqlCeCommand myCommand = myConnection.CreateCommand();
myCommand.CommandText = "INSERT INTO [vocab] ([wth], [weng]) VALUES " + " ('" + this.textBox1.Text + "','" + this.textBox2.Text + "' ) ";
myCommand.CommandType = CommandType.Text;
myCommand.ExecuteNonQuery();
myConnection.Close();
MessageBox.Show("Save Successfully");
frmHome f = new frmHome();
f.Show();
|
|
|
|
|
Date :
2011-04-20 16:43:34 |
By :
nan |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 04
|