retrieving extra info through FillSchema of a table

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
 
R

Rajesh Tiwari

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top