J
Joaquim Pinto
Hi All,
I'm making a dll that opens a conn to a database and must return all
data from a particular row by using the getstring() method.
if i only have one record everything goes well.
the problem apperas when i have more than one record.
the value returned is always the last value.
i wrote the following code:
public static string v;
OdbcConnection conn=
new OdbcConnection("STMT=;DSN=LigaMaquinas;PORT=;UID=;DB=maquinas;OPTION=0;SERVER=localhost");
string mySelectQuery = "SELECT * FROM maquinas";
OdbcCommand myCommand = new OdbcCommand(mySelectQuery,conn);
conn.Open();
OdbcDataReader myReader;
myReader = myCommand.ExecuteReader();
while(myReader.Read())
{
v=myReader.GetString(2);
}
return v;
Can anyone give an hand on this.
I'm making a dll that opens a conn to a database and must return all
data from a particular row by using the getstring() method.
if i only have one record everything goes well.
the problem apperas when i have more than one record.
the value returned is always the last value.
i wrote the following code:
public static string v;
OdbcConnection conn=
new OdbcConnection("STMT=;DSN=LigaMaquinas;PORT=;UID=;DB=maquinas;OPTION=0;SERVER=localhost");
string mySelectQuery = "SELECT * FROM maquinas";
OdbcCommand myCommand = new OdbcCommand(mySelectQuery,conn);
conn.Open();
OdbcDataReader myReader;
myReader = myCommand.ExecuteReader();
while(myReader.Read())
{
v=myReader.GetString(2);
}
return v;
Can anyone give an hand on this.