Amar Galla
Guest
|
Posted:
Tue Jan 18, 2005 6:42 pm Post subject:
Re: Ado.net |
|
|
For database access you need a bit more security permission than the default
of wss_minimal. Best practice is to implement code security and create a
proper permission set for your webpart. But for a quick workaround, just
open your web.config file, and locate a key called something like trust
level. You will see that it is set to WSS_Minimal. Just change it to Full.
Your code should work properly.
--
Hope this helps.
Regards,
Amar Galla
http://www.dotnetjunkies.com/weblog/amar/
"Ajay Kumar" <AjayKumar@discussions.microsoft.com> wrote in message
news:D7D4406C-B164-453A-B750-15834579A5C9@microsoft.com...
| Quote: | Hi All,
I am creating a webpart connecting to excel datasource by using
oledbconnection of Ado.net . i am getting excepiton on loading this
webpart.
is any kind of setting is required to handle ado.net in webpart.
Pls suggest me a solution.
waiting for reply.
Ajay kumar
String sConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" +
"Data Source=C:\\Vendor1.xls;" +
"Extended Properties=Excel 8.0;";
// Create connection object by using the preceding connection string.
OleDbConnection objConn = new OleDbConnection(sConnectionString);
// Open connection with the database.
objConn.Open();
// The code to follow uses a SQL SELECT command to display the data from
the worksheet.
// Create new OleDbCommand to return data from worksheet.
OleDbCommand objCmdSelect =new OleDbCommand("SELECT * FROM range1",
objConn);
//Create new OleDbDataAdapter that is used to build a DataSet
// based on the preceding SQL SELECT statement.
OleDbDataAdapter objAdapter1 = new OleDbDataAdapter();
|
|
|