Odd stored proc problem (table ok but not returning data).

Tim Field

Member
Joined
Aug 31, 2005
Messages
20
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
}
 
I just noticed you are using both a DataAdapter and a DataReader in your original code - if you are wanting to loop with a DataReader then I would try to remove the DataAdapter related code and see if that clears up the problem.
 
Back
Top