Hi, I keep getting a "cannot implicitly convert type 'object' to 'string'" on the bolded line. Your help would be greatly appreciated.
Code:
//object vars
SqlConnection sqlConnection;
SqlDataAdapter sqlDataAdapter;
SqlCommand sqlCommand;
DataSet ds;
//DataTable dataTable;
//Define query
string sql;
sql = "SELECT * FROM [Environmental Safety Solutions$Contract Site No_] As C INNER JOIN [Environmental Safety Solutions$Ship-to Address]As S ON C.[Sell-to Customer No_] = S.[Customer No_] AND S.Code = C.[Site _ Ship-to Code] INNER JOIN [Environmental Safety Solutions$PRS Site Tracker] As P ON [prs#] = [Actual Contract Site No_] WHERE [Actual Contract Site No_] = '"+prsId+"'";
//pass the stored proc name and SqlConnection
//SqlConnection oSQLConn = new
SqlConnection oSQLConn = new SqlConnection("Data Source=LOHKI;Initial Catalog=NavPlay;User Id=IntranetViewer;Password=ess4apc;");
sqlCommand = new SqlCommand(sql, oSQLConn);
//instantiate SqlAdapter and DataSet
sqlDataAdapter = new SqlDataAdapter(sqlCommand);
ds = new DataSet();
//populate the DatSet
sqlDataAdapter.Fill(ds, "Sites");
//apply sort to the DefaultView to sort by site name
ds.Tables[0].DefaultView.Sort = "Name";
//Fill labels with data
[b]SiteName.Text = ds.Tables[0].Rows[0]["Name"];[/b]