Quantcast
Channel: Windows Forms General forum
Viewing all articles
Browse latest Browse all 12583

Dynamic data entry ASP.NET C#

$
0
0
Please can anyone tell me why im gettin this error : Incorrect syntax near 'ListBus' .

Its refering to  sda.Fill(ds,"ListBus")

in the code below
private void bindGrid()
        {
            string lidhja = "SERVER=localhost\\SqlExpress;Database=Projekti2;" + "Integrated Security=true;";
            SqlConnection cnnDB = new SqlConnection(lidhja);
            string query = string.Format("SELECT a.RouteID,a.Departure,a.Price FROM ListBus a INNER JOIN Route b ON a.RouteID=b.RouteID" +"WHERE a.Departure='{0}' AND b.StartPlace='{1}' AND b.DestPlace='{2}'",
                    DepartureDate.Text, DropDownList1.SelectedValue, DropDownList2.SelectedValue);

            
            using (SqlDataAdapter sda = new SqlDataAdapter(query, cnnDB))
            {
                DataSet ds = new DataSet();
                sda.Fill(ds, "ListBus");
                GridView1.DataSource = ds.Tables["ListBus"].DefaultView;
                GridView1.DataBind();
            }
        }


Viewing all articles
Browse latest Browse all 12583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>