Hi all,
Im doing some pretty standard stuff here. The database is ok and the proc returns 200 records when I run this directly in query analyser. The datareader is returning the recordset but Im getting no records. Any ideas?
Thanks! Tim
--------------------------------------------------------
SqlConnection mySqlConnection = new SqlConnection();
string strConn = "";
strConn = "Data Source=" + this.textBoxInstance.Text + ";" ;
strConn += "DataBase= " + this.textBoxDBName.Text + ";" ;
//strConn += " Integrated Security=SSPI ;" ;
strConn += "User ID = sa;" ;
strConn += " connection timeout=10000" ;
mySqlConnection.ConnectionString = strConn;
SqlCommand cmd = mySqlConnection.CreateCommand();
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "sta_pix_Create_Adnos";
SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand = cmd;
cmd.Connection.Open();
// use the sqldatareader
dr = cmd.ExecuteReader();
string hello;
if(dr.Read())
{
// This will be the UPN
hello = dr.GetString(0); // first column
}
Im doing some pretty standard stuff here. The database is ok and the proc returns 200 records when I run this directly in query analyser. The datareader is returning the recordset but Im getting no records. Any ideas?
Thanks! Tim
--------------------------------------------------------
SqlConnection mySqlConnection = new SqlConnection();
string strConn = "";
strConn = "Data Source=" + this.textBoxInstance.Text + ";" ;
strConn += "DataBase= " + this.textBoxDBName.Text + ";" ;
//strConn += " Integrated Security=SSPI ;" ;
strConn += "User ID = sa;" ;
strConn += " connection timeout=10000" ;
mySqlConnection.ConnectionString = strConn;
SqlCommand cmd = mySqlConnection.CreateCommand();
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "sta_pix_Create_Adnos";
SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand = cmd;
cmd.Connection.Open();
// use the sqldatareader
dr = cmd.ExecuteReader();
string hello;
if(dr.Read())
{
// This will be the UPN
hello = dr.GetString(0); // first column
}