S
shaila th via .NET 247
(Type your message here)
--------------------------------
From: shaila th
I have created a .NET Web service project. I'm trying to connect to a SQL Server database from my webservice.
I downloaded the Data Access Application block for accessing data from sqlserver db.
The sql statement alone works fine, I have tested it.
I get a "Page cannot be displayed error" while invoking this method.
Can anyone let me know why I'm getting this problem...?
Here is my code:
[WebMethod]
public DataSet CreateTest()
{
//Establish connection to SQLServer database
SqlConnection conn = new SqlConnection("Server=xxxxx;User=xxxxx;Database=xxxxx");
//I'll be calling a Stored Procedure instead of this sql statement
SqlDataAdapter adapter1 = new SqlDataAdapter("INSERT INTO test (test_type,test_desc,test_date,owner_name,owner_account,test_name,cust_name,cust_phone,cust_fax,test_status) values ('x','x','04-20-2004','x', 'x', 'x', 'x', '0000','0000', 'Accepted')",conn);
//Open the database connection
DataSet ds1 = new DataSet();
// Open the database connection
conn.Open();
adapter1.Fill(ds1,"tests");
// Close db connection
conn.Close();
return ds1;
}
--------------------------------
From: shaila th
I have created a .NET Web service project. I'm trying to connect to a SQL Server database from my webservice.
I downloaded the Data Access Application block for accessing data from sqlserver db.
The sql statement alone works fine, I have tested it.
I get a "Page cannot be displayed error" while invoking this method.
Can anyone let me know why I'm getting this problem...?
Here is my code:
[WebMethod]
public DataSet CreateTest()
{
//Establish connection to SQLServer database
SqlConnection conn = new SqlConnection("Server=xxxxx;User=xxxxx;Database=xxxxx");
//I'll be calling a Stored Procedure instead of this sql statement
SqlDataAdapter adapter1 = new SqlDataAdapter("INSERT INTO test (test_type,test_desc,test_date,owner_name,owner_account,test_name,cust_name,cust_phone,cust_fax,test_status) values ('x','x','04-20-2004','x', 'x', 'x', 'x', '0000','0000', 'Accepted')",conn);
//Open the database connection
DataSet ds1 = new DataSet();
// Open the database connection
conn.Open();
adapter1.Fill(ds1,"tests");
// Close db connection
conn.Close();
return ds1;
}