473,382 Members | 1,390 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Passing a user Id to oledbdataprovider to access XL spreadsheet.

I had been successfully accessing an XL spreadsheet using
the OleDBDataadapter with the code below, until the
Security department set permissions on the file. Now this
code cannot access it even though the account that the
aSP.NET is running under has permissions to the file.

I tried using "Integrated Security=SSPI" in the
connectionString but it didn't work either.

I think the only problem is that I need to tell the OLEDB
provider to use a certain user id. Anyone have any ideas
how to make this work?
Dim DA As New OleDb.OleDbDataAdapter()
Dim Conn As New OleDb.OleDbConnection()

Conn.ConnectionString
= "provider=Microsoft.Jet.OLEDB.4.0; " & _
"data source=" & psXLFile & ";" & _
"Extended Properties=Excel 8.0;"

' Get source data
DA = New OleDb.OleDbDataAdapter("Select * From
[" & psSheet & "$]", Conn)
DA.Fill(DT)

Jul 19 '05 #1
2 1523
Not sure if this will work, but have you tried using the
uid= and pwd= to pass the user id and password? Note that
using this method the id and password need to be in
cleartext which is obviously a bad thing in a domain.

Jeff Levinson

Author of "Building Client/Server Applications with
VB.NET: An Example Driven Approach"
-----Original Message-----
I had been successfully accessing an XL spreadsheet usingthe OleDBDataadapter with the code below, until the
Security department set permissions on the file. Now thiscode cannot access it even though the account that the
aSP.NET is running under has permissions to the file.

I tried using "Integrated Security=SSPI" in the
connectionString but it didn't work either.

I think the only problem is that I need to tell the OLEDBprovider to use a certain user id. Anyone have any ideashow to make this work?
Dim DA As New OleDb.OleDbDataAdapter()
Dim Conn As New OleDb.OleDbConnection()

Conn.ConnectionString
= "provider=Microsoft.Jet.OLEDB.4.0; " & _
"data source=" & psXLFile & ";" & _
"Extended Properties=Excel 8.0;"

' Get source data
DA = New OleDb.OleDbDataAdapter("Select * From[" & psSheet & "$]", Conn)
DA.Fill(DT)

.

Jul 19 '05 #2
You may need read/write permission to this file's folder and the system
temporarily folder. You may try to se the ASP.NET's account to local
administrators group to see if it will help.

Luke

(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Matthew | last post by:
I've been trying to find a way to gather up data contained in a table or tables on a previously generated html page in order to send it to a cgi for further processing. Ideally this would scrape...
2
by: AlexB | last post by:
I had been successfully accessing an XL spreadsheet using the OleDBDataadapter with the code below, until the Security department set permissions on the file. Now this code cannot access it even...
2
by: Colleyville Alan | last post by:
I have been working on an application that queries data from Access, loads it into an array, and then writes it to an Excel spreadsheet. I use the array approach to have fine control over spacing,...
2
by: Colleyville Alan | last post by:
I have been working on a project that uses MS Access to get mutual fund performance and write it to a spreadsheet in a formatted manner. The user inputs the company name, the database looks at the...
2
by: Don W. Reynolds | last post by:
Hi All, I am sent an excel spreadsheet on a daily basis. Sometimes it contains 10 rows; sometimes it contains over 5000 rows. I copy this spreadsheet into another spreadsheet and verify the...
1
by: Johnny Meredith | last post by:
Dear All, I have an Access database that tracks the progress of income tax audits. When the taxing authorities make a change (an "Adjustment"), I record the pertinent information in the...
3
by: Brooke | last post by:
I am new to ASP.NET, but have been programming for about 14 years (C# about 2 years). My manager asked me to develop a web application that would allow employees to view a spreadsheet that is used...
3
by: jonosborne | last post by:
I know this is very long-winded but I am trying to include all information. I currently manage a data input database which is used within a multiple user environment. This data is stored within...
1
by: steevan16 | last post by:
Hi, Not sure if I am in the right section. Just have a query about manipulating excel spreadsheet using vbscript. I am developing a vbscript which runs on client xp machines to retrieve certain...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.