|
|
|
C# phpMyAdmin อ่านภาษาไทยไม่ได้ เป็นเครื่องหมายคำถาม ??????? |
|
|
|
|
|
|
|
ผมป้อนข้อมูลผ่าน C# แล้วเชื่อมต่อ phpmyadmin แล้ว แต่ตอนเพิ่มข้อมูลลงในตาราง ไม่สามารถอ่านได้ครับ
ตารางผมกำหนดแบบนี้ครับ
Code (C#)
public Form2()
{
InitializeComponent();
server = "localhost";
database = "db2";
uid = "root";
password = "root";
string connectionString;
connectionString = "Server=localhost;User Id=root; Password=1234; Database=db2; Pooling=false";
connection = new MySqlConnection(connectionString);
connection.Open();
}
private void button1_Click(object sender, EventArgs e)
{
MySql.Data.MySqlClient.MySqlCommand objCmd;
String date = dateTimePicker1.Text;
String re_date = dateTimePicker2.Text;
String re_p = null;
String pay=null;
//recive
if (radioButton1.Checked)
re_p = "this place";
else if (radioButton2.Checked)
re_p = "Fax";
else
re_p = "post";
//Payment
if (comboBox1.SelectedIndex == 0)
pay = "money";
else if (comboBox1.SelectedIndex == 1)
pay = "receipt";
else if (comboBox1.SelectedIndex == 2)
pay = "transfer";
else if (comboBox1.SelectedIndex == 3)
pay = "unpaid";
//command insert
String strSQL = "insert into profile values('" + ID.Text.Trim() + "','" + date + "','" + name.Text.Trim() + "','" + adr.Text.Trim() + "','" + tel.Text.Trim() + "','" + fax.Text.Trim() + "','" + mail.Text.Trim() + "','" + obj.Text.Trim() + "','" + num.Text.Trim() + "','" + syn.Text.Trim() + "','" + namet.Text.Trim() + "')";
//cmd.Connection = connection;
objCmd = new MySql.Data.MySqlClient.MySqlCommand();
objCmd.Connection = connection;
objCmd.CommandText = strSQL;
objCmd.ExecuteNonQuery();
MessageBox.Show("complete");
connection.Close();
}
Tag : .NET, MySQL, C#
|
|
|
|
|
|
Date :
2014-07-09 19:09:31 |
By :
pcbimon |
View :
2219 |
Reply :
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ขอบคุณครับ
|
|
|
|
|
Date :
2014-07-10 07:42:53 |
By :
pcbimon |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 00
|