T trint Jan 12, 2005 #1 Here is the vb.net version of what I need to do in c#: myString = drSQL.Item("columnName").ToString() Thanks, Trint
Here is the vb.net version of what I need to do in c#: myString = drSQL.Item("columnName").ToString() Thanks, Trint
M Marek Jan 12, 2005 #2 I see no syntactic problem except missing ";" and undeclared variable string myString = drSQL.Item("columnName").ToString();
I see no syntactic problem except missing ";" and undeclared variable string myString = drSQL.Item("columnName").ToString();
T trint Jan 12, 2005 #3 well, I get this error though: (542): 'System.Data.SqlClient.SqlDataReader' does not contain a definition for 'Item'
well, I get this error though: (542): 'System.Data.SqlClient.SqlDataReader' does not contain a definition for 'Item'
M Marek Jan 12, 2005 #4 Have a look here then http://msdn.microsoft.com/library/d...temdatasqlclientsqldatareadermemberstopic.asp in C#, the properties are indexed like ProperyName[parameters] and in SqlDataReader, what is .Item() in VB is SqlDataReader[] indexer so, I guess string myString = drSQL["columnName"].ToString(); should work
Have a look here then http://msdn.microsoft.com/library/d...temdatasqlclientsqldatareadermemberstopic.asp in C#, the properties are indexed like ProperyName[parameters] and in SqlDataReader, what is .Item() in VB is SqlDataReader[] indexer so, I guess string myString = drSQL["columnName"].ToString(); should work
J Joakim Karlsson Jan 12, 2005 #5 SqlDataReader.Item is what is known as an indexer in C#. The syntax should be: myString = drSQL["columnName"].ToString(); Indexers are supposed to make the code prettier, but most of the time these kinds of syntactic sugar just makes the code more confusing. Regards, Joakim
SqlDataReader.Item is what is known as an indexer in C#. The syntax should be: myString = drSQL["columnName"].ToString(); Indexers are supposed to make the code prettier, but most of the time these kinds of syntactic sugar just makes the code more confusing. Regards, Joakim
M Matthew Smith Jan 14, 2005 #7 trint said: Here is the vb.net version of what I need to do in c#: myString = drSQL.Item("columnName").ToString() Click to expand... Perhaps you should be writing: myString = drSQL["columnName"].ToString(); If drSQL is a DataRow.
trint said: Here is the vb.net version of what I need to do in c#: myString = drSQL.Item("columnName").ToString() Click to expand... Perhaps you should be writing: myString = drSQL["columnName"].ToString(); If drSQL is a DataRow.