retrieving extra info through FillSchema of a table

  • Thread starter Thread starter chris
  • Start date Start date
C

chris

I am trying to build this syntax dynamically :

dataAdapterTabel1.UpdateCommand.Parameters.Add("@veld2", OleDbType.VarChar,
50, "veld2")

I would like to get the values '50' and char and columnName of a tabel .
I checked the fillschema but that gives me only the ColumnName...

Can it be done ?

Private Sub GetSimpleTableSchema()
Dim dtc As DataColumn
Dim toon As String
dataAdapterTabel1.FillSchema(dtTable, SchemaType.Source)
For Each dtc In dtTable.Columns
toon = dtc.ColumnName
Next
End Sub
 
try something like this

SqlCommand cmd1=new SqlCommand("select * from "+TableName,con);
SqlDataReader
dr=cmd1.ExecuteReader(CommandBehavior.SchemaOnly|CommandBehavior.KeyInfo
);
DataTable dt=dr.GetSchemaTable();
foreach (DataRow myRow in dt.Rows)
{
FieldName=dt.Rows[0].ToString();
FieldType=dt.Rows[12].ToString();
FieldLength=dt.Rows[2].ToString();

}

hope this helps

Rajesh
 
Back
Top