Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 .NET Inside SQL Server (2005)
 Please Help me

Author  Topic 

rabail684
Starting Member

8 Posts

Posted - 2007-04-24 : 05:39:52
SqlDataAdapter da2 = new SqlDataAdapter("SELECT Personal.NumberofBeds FROM Personal WHERE Personal.HospitalID==Patients.HospitalID AND Personal.HospitalName==PName", con);




i've an application built in c#.net and connected with sql server 2005's database,so executing this command it gives exception as invalid syntax...WHAT'S rong with this query? PName is a string taken as this ::


SqlDataAdapter da = new SqlDataAdapter("select HospitalName,Totalpatients from Patients", con);
DataSet ds = new DataSet();
da.Fill(ds,0,0,"Patients");
SqlCommandBuilder cb = new SqlCommandBuilder(da);
string PName=System.Convert.ToString(ds.Tables["Patients"].Rows[ii]["HospitalName"]);

someone may also tell me Please that in this current scenario,,whts the best way to select data from multiple tables based on some clauses?

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-04-24 : 05:44:37
duplicate thread http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=82550


KH

Go to Top of Page
   

- Advertisement -