2011-07-27 9 views

答えて

1

は、このクエリは、フォームで何かを返す:あなたはタイプで見ているZEROFILL

field   type       null key default extra 
fieldname  int(10) unsigned zerofill  no   0  

ので、フラグを取得するint型で返される文字列は「ZEROFILL」が含まれている場合文字列:このような

何かがトリックを行います:

static void Main(string[] args) 
{ 
    dim conn as MySqlConnection 
    conn = new MySqlConnection 
    conn.ConnectionString = "Server = yourserver; Database = yourdb; Uid = youruser;Pwd = yourpassword;" 

    conn.Open 

    MySqlCommand cmd = new MySqlCommand 
    cmd.Connection = conn 
    cmd.CommandText = "SHOW COLUMNS IN yourtable" 
    cmd.CommandType = CommandType.Text 

    dim reader as MySqlDataReader 
    reader = cmd.ExecuteReader 

    while reader.Read 
     Console.WriteLine("Field:{0}, zerofill:{1}",reader("field"),if(reader("type").ToString().Contains("zerofill"),true,false)) 
    end while 
    conn.Close() 
} 
関連する問題