I am using Visual Studio 2008.
I have created a Winforms application, and I am trying to extract the table name from a SQL statement.
con = new SqlConnection(connString);
String queryString = "Select CUSTOMER_NAME from CUSTOMER_DETAIL";
Is there any function to do so?
Please help me out.
It’s good that you have mentioned Java’s ResultSetMetaData. Quoting that link:
As for C#, you can get the same information using the DataColumn Class.
DataTypeProperty ofDataColumnclass can be used to get (and to set) the type of data stored in column,AllowDBNullcan be used to get (and set) the value that indicates whether null values are allowed in this column, etc… To get the full list ofDataColumnproperties follow the link I have posted above.Sample code (gets column datatype):