Windows Authenticated database on WebMethod not working
up vote
0
down vote
favorite
I have tried using SQL Server authenticated Database it worked but with this Windows authenticated DB, I can't figure out what to do.
What could be the problem?
[WebMethod]
public static List<string> GetEmployeeName(string empName)
{
List<string> Models = new List<string>();
using (SqlConnection con = new SqlConnection(@"Data Source=PHAPPCVTSQL04; Initial Catalog=ECP_IQCDATA_SEM; Integrated Security=True;"))
{
using (SqlCommand cmd = new SqlCommand())
{
cmd.CommandText = "SELECT DISTINCT [Model] FROM [MRB_Model-Approver]";
con.Open();
cmd.Parameters.AddWithValue("@SearchModel", empName);
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
Models.Add(dr["Model"].ToString());
}
con.Close();
return Models;
}
}
}
c# sql asp.net ajax
add a comment |
up vote
0
down vote
favorite
I have tried using SQL Server authenticated Database it worked but with this Windows authenticated DB, I can't figure out what to do.
What could be the problem?
[WebMethod]
public static List<string> GetEmployeeName(string empName)
{
List<string> Models = new List<string>();
using (SqlConnection con = new SqlConnection(@"Data Source=PHAPPCVTSQL04; Initial Catalog=ECP_IQCDATA_SEM; Integrated Security=True;"))
{
using (SqlCommand cmd = new SqlCommand())
{
cmd.CommandText = "SELECT DISTINCT [Model] FROM [MRB_Model-Approver]";
con.Open();
cmd.Parameters.AddWithValue("@SearchModel", empName);
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
Models.Add(dr["Model"].ToString());
}
con.Close();
return Models;
}
}
}
c# sql asp.net ajax
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have tried using SQL Server authenticated Database it worked but with this Windows authenticated DB, I can't figure out what to do.
What could be the problem?
[WebMethod]
public static List<string> GetEmployeeName(string empName)
{
List<string> Models = new List<string>();
using (SqlConnection con = new SqlConnection(@"Data Source=PHAPPCVTSQL04; Initial Catalog=ECP_IQCDATA_SEM; Integrated Security=True;"))
{
using (SqlCommand cmd = new SqlCommand())
{
cmd.CommandText = "SELECT DISTINCT [Model] FROM [MRB_Model-Approver]";
con.Open();
cmd.Parameters.AddWithValue("@SearchModel", empName);
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
Models.Add(dr["Model"].ToString());
}
con.Close();
return Models;
}
}
}
c# sql asp.net ajax
I have tried using SQL Server authenticated Database it worked but with this Windows authenticated DB, I can't figure out what to do.
What could be the problem?
[WebMethod]
public static List<string> GetEmployeeName(string empName)
{
List<string> Models = new List<string>();
using (SqlConnection con = new SqlConnection(@"Data Source=PHAPPCVTSQL04; Initial Catalog=ECP_IQCDATA_SEM; Integrated Security=True;"))
{
using (SqlCommand cmd = new SqlCommand())
{
cmd.CommandText = "SELECT DISTINCT [Model] FROM [MRB_Model-Approver]";
con.Open();
cmd.Parameters.AddWithValue("@SearchModel", empName);
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
Models.Add(dr["Model"].ToString());
}
con.Close();
return Models;
}
}
}
c# sql asp.net ajax
c# sql asp.net ajax
asked Nov 13 at 9:42
John Robert
63
63
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
try it
SqlConnection(@Server=PHAPPCVTSQL04;Database=myDataBase;Trusted_Connection=True);
Or
SqlConnection(@Server=.;Database=myDataBase;Trusted_Connection=True);
Thank you Law but still not working with both answer.
– John Robert
Nov 14 at 1:14
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
try it
SqlConnection(@Server=PHAPPCVTSQL04;Database=myDataBase;Trusted_Connection=True);
Or
SqlConnection(@Server=.;Database=myDataBase;Trusted_Connection=True);
Thank you Law but still not working with both answer.
– John Robert
Nov 14 at 1:14
add a comment |
up vote
0
down vote
try it
SqlConnection(@Server=PHAPPCVTSQL04;Database=myDataBase;Trusted_Connection=True);
Or
SqlConnection(@Server=.;Database=myDataBase;Trusted_Connection=True);
Thank you Law but still not working with both answer.
– John Robert
Nov 14 at 1:14
add a comment |
up vote
0
down vote
up vote
0
down vote
try it
SqlConnection(@Server=PHAPPCVTSQL04;Database=myDataBase;Trusted_Connection=True);
Or
SqlConnection(@Server=.;Database=myDataBase;Trusted_Connection=True);
try it
SqlConnection(@Server=PHAPPCVTSQL04;Database=myDataBase;Trusted_Connection=True);
Or
SqlConnection(@Server=.;Database=myDataBase;Trusted_Connection=True);
answered Nov 13 at 9:49
Law Hong
1
1
Thank you Law but still not working with both answer.
– John Robert
Nov 14 at 1:14
add a comment |
Thank you Law but still not working with both answer.
– John Robert
Nov 14 at 1:14
Thank you Law but still not working with both answer.
– John Robert
Nov 14 at 1:14
Thank you Law but still not working with both answer.
– John Robert
Nov 14 at 1:14
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53278041%2fwindows-authenticated-database-on-webmethod-not-working%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown