【发布时间】:2014-01-09 16:48:37
【问题描述】:
要获取列的数据类型,我在 C# 中使用以下代码
System.Data.SQLite.SQLiteConnection con = new System.Data.SQLite.SQLiteConnection("Data Source=C:\\Users\\SaMax\\Documents\\CustomersDB.s3db; Version=3; FailIfMissing=True;");
System.Data.SQLite.SQLiteCommand cmd = new System.Data.SQLite.SQLiteCommand("select typeof(Column_Name) from Table_Name;");
cmd.Connection = con;
try
{
con.Open();
string str = cmd.ExecuteScalar().ToString();
con.Close();
MessageBox.Show(str);
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
它有效。但是我想知道它是否可以,SQL,MySql 也可以。
【问题讨论】: