2011-12-26 1 views
1
public string getLabel(int ReportID, int labelID) 
{ 
    string s; 
    System.Data.SqlClient.SqlConnection myConnection = new System.Data.SqlClient.SqlConnection("Data Source=*****;Persist Security Info=True;Password=****;User ID=*********;Initial Catalog=iLoyaltyDW"); 
    SqlCommand myCommand = new SqlCommand(); 
    myCommand.Connection = myConnection; 
    myCommand.CommandType = CommandType.Text; 
    myCommand.CommandText = "select ...."; 
    myConnection.Open(); 

    SqlDataReader reader = myCommand.ExecuteReader(); 

    while (reader.Read()) 
    { 
     s = reader.GetString(0); 
    } 

    return s;   
} 

ответ

Смежные вопросы