Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DataSet Error - Confusing?

Status
Not open for further replies.

CJAI

MIS
Oct 21, 2003
224
US
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]
 
and how about getting it to change dataset value to date?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top