5
Answers

Connecting to ADS then using SQL to populate a datagridview.

DAN HICKSON

DAN HICKSON

12y
3k
1
Hi all. Using visual studio. We are using sybase advantage server which we can see and connect to in the server explorer and view tables etc.

I have created a form with a datagridview on there.

I am trying to populate the datagridview using sql and then filtering it.

I am getting syntax error and it highlights where it opens the connection.

here is my code:

string ConnectionPath = "Data Source=\\pw125n-12365\\localdbf\\1236_dbf.add;User ID=123;Password=123;ServerType=REMOTE";    
           string sql = "SELECT corethick FROM build";
            AdsConnection Connection = new AdsConnection(ConnectionPath);
            AdsDataAdapter dataadapter = new AdsDataAdapter(sql,Connection);
            DataSet ds = new DataSet();
            Connection.Open();
            dataadapter.Fill(ds, "build");
            Connection.Close();        
            DataView dv;
            dv = new DataView(ds.Tables[0], "corethick > 3.100", "corethick", DataViewRowState.CurrentRows);
           dataGridView1.DataSource = dv;
         

any help much appreciated.
Answers (5)