WPF windows authentication for SQL connection

1.2k views Asked by At

I have a windows form solution which I have to implement to WPF browser application. All the code does is it queries an sql server based on a parameter given in a textbox.

string conString= @"Data Source = SQLserver; Initial Catalog = database; Integrated Security=SSPI;";
using (SqlConnection c = new SqlConnection(conString))
{
    c.Open();
    using (SqlDataAdapter a = new SqlDataAdapter(
    @"SELECT * from datatable where col1 = '" + textBox1.Text + @"' 
      Order By col2;", c))
    {
        // fill a data table
        a.Fill(source);
    }
}

This sql server accepts only integrated windows authentication. So to work I simply runas the winform exe under the required user account.

How can I somehow run that WPF under the same account? Please note that it needs to be hosted on a web server and has to be available for many users.

0

There are 0 answers