Hi Bob,
Foll. is the code snippet to get a datatable of schema values from your sql query.
private DataTable CreateSchema()
{
OleDbConnection conn=new OleDbConnection(@"provider=Microsoft.JET.OLEDB.4.0; data source=D:\User\Sanjay\SMSPress30\SmsPress\Data\db.mdd");
conn.Open();
OleDbCommand cmd=new OleDbCommand("select * from t_group",conn);
OleDbDataReader read= cmd.ExecuteReader();
DataTable dt=new DataTable();
dt=read.GetSchemaTable();
cmd.Dispose();
read.Close();
conn.Close();
conn.Dispose();
return dt;
}
To get the fieldsize of a particular column use the foll. code:
DataRow[] dr=dt.Select("ColumnName='GroupName'");
if(dr.Length > 0)
{
MessageBox.Show("Fieldsize is:" + dr[0]["ColumnSize"].ToString());
}