Link to home
Start Free TrialLog in
Avatar of omegalove
omegalove

asked on

'System.Data.SqlClient.SqlConnection' does not contain a definition

Error      10      'System.Data.SqlClient.SqlConnection' does not contain a definition for 'ExecuteQuery' and no extension method 'ExecuteQuery' accepting a first argument of type 'System.Data.SqlClient.SqlConnection' could be found (are you missing a using directive or an assembly reference?)      C:\inetpub\wwwroot\OmegaLove.Web\OmegaLove.Web\Controls\UniGrid.ascx.cs      583      26      OmegaLove.Web
 

SqlConnection con = new SqlConnection();
                con.ConnectionString = ConfigurationManager.ConnectionStrings["omegaloveConnectionString"].ConnectionString;

                ds = con.ExecuteQuery(this.Query, this.QueryParameters, this.CompleteWhereCondition, this.OrderBy);
ASKER CERTIFIED SOLUTION
Avatar of himanshut
himanshut
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of omegalove
omegalove

ASKER

Command cmd =
con.open?

con.close?

 // Reload the data with current parameters
                SqlConnection con = new SqlConnection();
                con.ConnectionString = ConfigurationManager.ConnectionStrings["omegaloveConnectionString"].ConnectionString;
               
                ds = con.ExecuteQuery(this.Query, this.QueryParameters, this.CompleteWhereCondition, this.OrderBy);

I don't have the syntax.
hello?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
con.ConnectionString.Open()

does not contain definion for Open and Close?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
con.ConnectionString.Open()
I have the namespace.
Still does not work.
SqlConnection con = new SqlConnection();
                con.ConnectionString = ConfigurationManager.ConnectionStrings["omegaloveConnectionString"].ConnectionString;
                con.Open();
                ds = con.ExecuteQuery(this.Query, this.QueryParameters, this.CompleteWhereCondition, this.OrderBy);
                con.Close();

Error      16      'System.Data.SqlClient.SqlConnection' does not contain a definition for 'ExecuteQuery' and no extension method 'ExecuteQuery' accepting a first argument of type 'System.Data.SqlClient.SqlConnection' could be found (are you missing a using directive or an assembly reference?)      C:\inetpub\wwwroot\OmegaLove.Web\OmegaLove.Web\Controls\UniGrid.ascx.cs      596      26      OmegaLove.Web
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
u lost me.
 public void ReloadData()
        {
            DataSet ds = null;

            // if datasource for unigrid is query (not dataset), then execute query
            if ((this.Query != null) && (this.Query != string.Empty))
            {
                // Reload the data with current parameters
                SqlConnection con = new SqlConnection();
                con.ConnectionString = ConfigurationManager.ConnectionStrings["omegaloveConnectionString"].ConnectionString;
                con.Open();
              //  ds = con.ExecuteQuery(this.Query, this.QueryParameters, this.CompleteWhereCondition, this.OrderBy);
                con.Close();

            }
            // external dataset is used
            else
            {
                if (this.OnDataReload != null)
                {
                    ds = OnDataReload(CompleteWhereCondition);
                }
                else
                {
                    ds = (DataSet)(this.DataSource);
                }
            }
k