Quantcast
Channel: Visual Studio and Visual Web Developer Express
Viewing all articles
Browse latest Browse all 3509

SqlDataAdapter constructor

$
0
0

I am trying to use sql data adapter and when I pass the query and the connection to the constructor an error that there is not constructor with 2 arguments pops up

Why is that

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using System.Data.SqlClient;
using System.Data;

namespace Ado1
{
    public partial class SqlDataAdapter : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            using (SqlConnection conn = new SqlConnection("Data Source=.\\SQLEXPRESS;Initial Catalog=AdventureWorks2012;Integrated Security=True"))
            {
                SqlDataAdapter dtAdapter = new SqlDataAdapter("select FirstName,MiddleName,LastName from Person.Person ", conn);

                conn.Open();
            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
           
        }
    }
}


Viewing all articles
Browse latest Browse all 3509

Trending Articles



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