Hi all,
I told you I'd be back ;-)
Oke here's the problem, I am currently toying around with retreiving data from my database server (SQL Server 2000) which is on my local LAN.
I just made a form with a button in Borland C#Builder and when you press the button it should connect and retreive and display..
The problem is that when we get to the while loop, it stops...or so it seems.
Here is the code:
Does someone have any suggestions or tips / advice?
- Raenius
"Free will...is an illusion"
I told you I'd be back ;-)
Oke here's the problem, I am currently toying around with retreiving data from my database server (SQL Server 2000) which is on my local LAN.
I just made a form with a button in Borland C#Builder and when you press the button it should connect and retreive and display..
The problem is that when we get to the while loop, it stops...or so it seems.
Here is the code:
Code:
SqlConnection myConnection = new SqlConnection("user id=test;" +
"password=test;server=192.168.x.x;" +
"Trusted_Connection=yes;" +
"database=netsentry; " +
"connection timeout=30");
try
{
myConnection.Open();
MessageBox.Show("Succesfully connected!");
try
{
SqlDataReader myReader = null;
SqlCommand myCommand = new SqlCommand("SELECT * FROM ROUTERS",myConnection);
myReader = myCommand.ExecuteReader();
while(myReader.Read())
{
// here it stops number 4 never displays
MessageBox.Show("4");
MessageBox.Show(myReader["routerID"].ToString());
MessageBox.Show(myReader["name"].ToString());
}
}
catch (Exception errr)
{
MessageBox.Show(errr.ToString());
}
//myConnection.Close();
}
catch(Exception err)
{
MessageBox.Show(err.ToString());
}
Does someone have any suggestions or tips / advice?
- Raenius
"Free will...is an illusion"