hello;
there is exception occur by this name -->Line 1: Incorrect syntax near 'clinicMainsurgery'. i also mention color area of exception in the code.
protected void Page_Load(object sender, EventArgs e)
{
SqlCommand cmd = new SqlCommand("select s.[surgery id],s.[patient surgery id],s.[surgery name],s.[surgery type id],s.[type name],s.[charges],s.[pv id],s.[patient visit charges] from 'clinicMainsurgery' s inner join 'surg' su on su.[surgery id]=s.[surgery id] inner join 'patientsurgery' ps on ps.[patient surgery id]=s.[patient surgery id]");
cmd.Connection = Connection.get();
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.SelectCommand = cmd;
da.Fill(ds);
GridView_surgery.DataSource = ds;
GridView_surgery.DataBind();
//if (!IsPostBack)
//{
// load_grid();
//}
}
regards
sumaira manzoor
Loading

sumaira manzoor hussain khanPosted Dec 19, 2011, 1:10 AM
sir, i am sending my database file, my code file , my erd and i am also sending my actual requirement in the form of diagram. please see this and tell me i am using right approach or not .
Pravin GhadgePosted Dec 18, 2011, 7:25 AM
can u send back up of ur database?
So that i can help u more.
sumaira manzoor hussain khanPosted Dec 18, 2011, 12:19 AM
i remove all single quotes . but there is no data display in my grid and another thing is , there is no exception occur in my code. this is my code after changes. now , i am sending my target diagram. i think , you can better understand what is my needs.
public void load_grid()
{ SqlCommand cmd = new SqlCommand("select s.[surgery id],s.[patient surgery id],s.[surgery name],s.[surgery type id],s.[type name],s.[charges],s.[pv id],s.[patient visit charges] from clinicMainsurgery s inner join surg su on su.[surgery id]=s.[surgery id] inner join patientsurgery ps on ps.[patient surgery id]=s.[patient surgery id]");
cmd.Connection = Connection.get();
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.SelectCommand = cmd;
da.Fill(ds);
GridView_surgery.DataSource = ds;
GridView_surgery.DataBind();
}
protected void Button_sugeries_Click(object sender, EventArgs e)
{
load_grid();
}
please help me brothers n sisters
Satyapriya NayakPosted Dec 17, 2011, 12:30 PM
May i know Why you are using single quotes in tables.
'clinicMainsurgery'
'patientsurgery'
change it to
clinicMainsurgery
patientsurgery
Thanks
Pravin GhadgePosted Dec 17, 2011, 10:24 AM
i have remove single quotes from ur querry.
Plz remove single quotes & check.
sumaira manzoor hussain khanPosted Dec 17, 2011, 9:30 AM
Pravin GhadgePosted Dec 17, 2011, 9:13 AM
Replace ur query with foll one:
SqlCommand cmd = new SqlCommand("select s.[surgery id],s.[patient surgery id],s.[surgery name],s.[surgery type id],s.[type name],s.[charges],s.[pv id],s.[patient visit charges] from clinicMainsurgery s inner join surg su on su.[surgery id]=s.[surgery id] inner join patientsurgery ps on ps.[patient surgery id]=s.[patient surgery id]");