Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi all,

 

I'm 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 I'm 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

}

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...