 |
|
[VB to C#] ช่วย แปลง Code VB นี้หน่วยครับ ให้เป็น Code C# ครับ ช่วยหน่วยครับ |
|
 |
|
|
 |
 |
|
Code (C#)
string sqlPrename = null;
sqlPrename = "SELECT * FROM Prename ORDER BY PrenameCode";
DataTable dtPrename = null;
var _with1 = Conn;
if (_with1.State == ConnectionState.Open)
_with1.Close();
_with1.ConnectionString = strConn;
_with1.Open();
var _with2 = com;
_with2.CommandType = CommandType.Text;
_with2.CommandText = sqlPrename;
_with2.Connection = Conn;
dr = _with2.ExecuteReader();
if (dr.HasRows) {
dtPrename = new DataTable();
dtPrename.Load(dr);
bsPrename = new BindingSource();
bsPrename.DataSource = dtPrename;
var _with3 = cboPrename;
_with3.DataSource = dtPrename;
_with3.DisplayMember = "PrenameName";
_with3.ValueMember = "PrenameCode";
bdPrename = _with3.DataBindings.Add("SelectedValue", bsPrename, "PrenameCode", true);
} else {
MessageBox.Show("ไม่มีข้อมูลคำนำหน้าชื่อ...กรุณาเพิ่มข้อมูลคำนำหน้าชื่อก่อน!!!", "ข้อผิดพลาด", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
|
 |
 |
 |
 |
Date :
2011-11-16 11:36:25 |
By :
webmaster |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ผมชอบใช้ที่นี่ในการ Convert ครับ
Code
|
 |
 |
 |
 |
Date :
2011-11-16 11:36:48 |
By :
webmaster |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอบคุณมาก ๆ ครับ สุดยอดเลยครับ
|
 |
 |
 |
 |
Date :
2011-11-16 11:48:51 |
By :
pissanu1988 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|