Ado.net
Windows Server Forum Index Windows Server
Server discussion on Windows platform.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web winserverhelp.com
Ado.net

 
Post new topic   Reply to topic    Windows Server Forum Index -> Portal Server Development
Author Message
Ajay Kumar
Guest





Posted: Tue Jan 18, 2005 3:51 pm    Post subject: Ado.net Reply with 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();
Back to top
Amar Galla
Guest





Posted: Tue Jan 18, 2005 6:42 pm    Post subject: Re: Ado.net Reply with quote

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();



Back to top
 
Post new topic   Reply to topic    Windows Server Forum Index -> Portal Server Development All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




New Topics Powered by phpBB