Select Data From Excel

May 22, 2008

Hello,

Is there a good way in SQL to select records that have been sent in an excel spreadsheet and import them into a temporary table?

I have a list of order codes that have different seg codes for example:

Order CodeZSeg
7625 ZBL
717009 ZBL
3277 ZCI
8144 ZCI

Each order code is unique and is classifed into a zseq. Depending on this zseg I need to update an existing table with the following field names and values for each order code:

For example for an order code classified as a ZBL I need to insert into an existing table that uses order code as the PK

Value Code: Patrac
Value Description: Patient Race
Value Type: ST
Units: None
Template Name: Lab_Master_
Field Name: AOE_BL_Race

There are multiple Value codes for each Zseg that will be inserted for each order code.

Can someone tell me the best way to do something like this?

View 1 Replies


ADVERTISEMENT

How To Select Data From Excel Table By Original Column Order?

Feb 21, 2007

Hello, everyone:

I have an Excel table that has columns like,

Vendoe_Name
Level
Address
Email
Phone

I use the statemen

SELECT * FROM OPENDATASOURCE('Microsoft.Jet.OLEDB.4.0',
'Data Source=C: est.xls;Extended Properties=Excel 8.0')...[Sheet1$]

and got output by column order,

Address
Email
Level
Phone
Vendoe_Name

How to make output by original column order like,

Vendoe_Name
Level
Address
Email
Phone

Any help will appreciated. Thanks

ZYT

View 1 Replies View Related

SQL Server 2012 :: Select Query To XLS Output - Export Data In Columns To Separate Tabs In Excel

Apr 21, 2015

Using below script to export the select statement result to .xls

declare @sql varchar(8000)
select @sql = 'bcp "select * from Databases..Table" queryout c:bcpTom.xls -c -t, -T -S' + @@servername
exec master..xp_cmdshell @sql

But result is not exporting in seperate tabs, all 4 column details are exporting in single cell.

how to export the data in columns to separate tabs in excel.

View 2 Replies View Related

Using A Excel Source To Get The Data From An Excel File Gets Null Values For A Couple Columns

Nov 19, 2007

I am using a Excel Source to get the data from an excel file to sql server 2005 table. A couple columns are coming in a double precision float, but some values have characters in them, but those values are coming out as null, even though I changed the datatype from float to unicode string. Any inputs on resolving this will be much appreciated.

Thanks,
Manisha

View 4 Replies View Related

How Do Create Table From Excel (based On Excel Column Name) And Import Data From It?

Jun 14, 2006

l've the following situation,

l've some excel files controlled by Vendor which changing frequently. The only thing does not change is the header name of each column.

So my question is, is there any way to create a new table based on the excel file selected including the column name in SSIS? So that l can use the data reader as source to select those columns l am interested on and start the integration.


Thanks.

Regards,
Yong Boon, Lim


p/s : The excel header is at the row 7.

View 3 Replies View Related

Problem With Retreving A Excel Data Through Excel Source Component.

Sep 18, 2007



Hello,

I have a problem with retreving a excel data through excel source component.

I have source component as Excel Source which will connect to my .xls sheet.
To retrieve the values from the sheet i am using a query as,
"SELECT F14,F3 FROM [Charac Defn & Assgnment$]"

The column F14 is not formatted so that the format of the cell is "General" I have a different type of values in the F14 column such as "PE","PES",15,20,20.00,8888.9999 etc..
While i click on preview button of Excel source it shows only the text values and not the int or decimal values, its returning NULL for those cells. I tried to use convert function, its throwing an error as

TITLE: Microsoft Visual Studio
------------------------------
There was an error displaying the preview.
------------------------------
ADDITIONAL INFORMATION:
Undefined function 'Convert' in expression. (Microsoft JET Database Engine)


Is there any other function to change the format of the cell or i need to some thing else
Please help me how to solve this issue.

View 6 Replies View Related

TSQL + VBA Excel 2003 - Importing Data From MS Excel 2003 To SQL SERVER 2000 Using Multi - Batch Processing

Sep 11, 2007

Hi,
I need to import an SQL string from MS Excel 2003 to SQL SERVER 2000.
The string I need to import is composed by 5 different several blocks and looks like:



Code Snippet

CommandLine01 = "USE mydb"
CommandLine02 = "SELECT Block ..."
CommandLine03 = "GO
ALTER TABLE Block...
GO"
CommandLine04 = "UPDATE Block..."
CommandLine05 = "SELECT Block..."

The detail of the SQL string is at:
http://forums.microsoft.com/msdn/showpost.aspx?postid=2093921&siteid=1&sb=0&d=1&at=7&ft=11&tf=0&pageid=1



I am trying to implement OJ's suggestion:
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2117223&SiteID=1
to use multi - batch processing to import the string to SQL SERVER, something like:




Code Snippet
Dim SqlCnt, cmd1, cmd2, cmd3
'set the properties and open a connection

cmd1="use my_db"
cmd2="create table mytb"
cmd3="insert into mytb"

SqlCnt.execute cmd1
SqlCnt.Execute cmd2
SqlCnt.Execute cmd3

Below is the code (just partial) I have, and I need help to complete it.
Thanks in advance,
Aldo.




Code Snippet
Function TestConnection()
Dim ConnectionString As New ADODB.Connection
Dim RecordSet As New ADODB.RecordSet

ConnectionString = "Driver={SQL Server};Server=myServer;Database=myDBName;Uid=UserName;Pwd=Password"
ConnectionString.Open

CmdLine01 = " USE " & myDB
CmdLine02 = " SELECT ACCOUNTS.FULLNAME FROM ACCOUNTS" ...

CmdLine03 = "GO
ALTER TABLE Block...
GO"

CmdLine04 = "UPDATE Block..."
CmdLine05 = "SELECT Block..."

RecordSet.Open CmdLine01, ConnectionString
RecordSet.Open CmdLine02, ConnectionString

ConnectionString.Execute CmdLine01
ConnectionString.Execute CmdLine02

'Retrieve Field titles
For ColNr = 1 To RecordSet.Fields.Count
ActiveSheet.Cells(1, ColNr).Value = RecordSet.Fields(ColNr - 1).Name
Next

ActiveSheet.Cells(2, 1).CopyFromRecordset RecordSet

'Close ADO objects
RecordSet.Close
ConnectionString.Close
Set RecordSet = Nothing
Set ConnectionString = Nothing

End Function






View 7 Replies View Related

Ask User To Select Excel

Jun 6, 2007

Dear friends, can anyone please tell me that how at the time when user executes the package i can ask a user to choose the datasource excel sheet and what are the constraints i have to take care of in the integration package desing.

thanks,

View 2 Replies View Related

Data Import Excel XML Defaults Which File Governs Excel Defaults?

Jul 21, 2015

I'm importing a multi tab spreadsheet using Import wizard, which I understand to use the same internals as SSIS. The total number of columns in the spread sheet will be over 500. The import wizard defaults everything to varchar 255. I understand there is an XML file I can manipulate to change this and they are located

C:Program FilesMicrosoft SQL Server100DTSMappingFiles

Assuming one of these will control Excel defaults, which one is it? None of the names lend themselves to the Excel as a source. SqlClientToMSSql10?

View 6 Replies View Related

Select Query Result In Excel Sheet

Mar 11, 2008

hi all
how can i put select query result in excel sheet.
can any one help me

Regards
js.reddy

View 2 Replies View Related

DB Engine :: Unable To Select Data From A Table Even After Providing Select Access

Aug 28, 2015

I am unable to the access on table even after providing the SELECT permission on table.

Used Query by me :

Here Test is schema ; Card is table ; User is Satish

To grant select on Table

GRANT SELECT ON TEST.Card  TO satish
Even after this it is not working, So provided select on schema also.
used query : GRANT SELECT ON SCHEMA::TEST  TO Satish.

View 8 Replies View Related

Pipeline Error-excel Source-data Reader Does Not Read In Meta Data

Apr 16, 2008

Hi all, i got this error:


[DTS.Pipeline] Error: "component "Excel Source" (1)" failed validation and returned validation status "VS_NEEDSNEWMETADATA".

and also this:

[Excel Source [1]] Warning: The external metadata column collection is out of synchronization with the data source columns. The column "Fiscal Week" needs to be updated in the external metadata column collection. The column "Fiscal Year" needs to be updated in the external metadata column collection. The column "1st level" needs to be added to the external metadata column collection. The column "2nd level" needs to be added to the external metadata column collection. The column "3rd level" needs to be added to the external metadata column collection. The "external metadata column "1st Level" (16745)" needs to be removed from the external metadata column collection. The "external metadata column "3rd Level" (16609)" needs to be removed from the external metadata column collection. The "external metadata column "2nd Level" (16272)" needs to be removed from the external metadata column collection.


I tried going data flow->excel connection->advanced editor for excel source-> input and output properties and tried to refresh the columns affected.
It seems that somehow the 3 columns are not read in from the source file?
ans alslo fiscal year, fiscal week is not set up up properly in my data destination?
anyone faced such errors before?

Thanks

View 13 Replies View Related

Transfer Data To Excel 2007 By Using SQL Server Data Transformation Services

Jun 11, 2007

My vendor requires data to be sent in Excel format.  Some of my tables have rows over 65,536 so I need to use Excel 2007 (Max of 1,048,576).  Right now my data sits in SQL 2000.  I am using MS SQL Enterprise Manager 8.0 to prepare the data.  Is there some kind of add on or selection I am missing to use DTS to export from SQL to Excel 2007?Thanks in advance. 

View 3 Replies View Related

Data Flow Task Error To Extract Data From Sql Server To Excel

Mar 28, 2008

Hi All,

I want to export data from SQL Server2005 to an Excel spreadsheet thru "Data Flow Task". I am using OLE DB for SQL Server for the source connection and a Connection To Excel as my destination source. The Excel spreadsheet (2003) exists and has the first row with column names. I don't have any warnings before trying to execute.

The SQL datable fileds are
i) ID - Int

ii) RefID
iii) txtRemarks - nvarchar(MAX)
iv) ddlWaterLevel - nvarchar(50)

While executing the tasks, I got the error
Error: 0xC0202025 at Data Flow Task, Excel Destination [427]: Cannot create an OLE DB accessor. Verify that the column metadata is valid.
Error: 0xC004701A at Data Flow Task, DTS.Pipeline: component "Excel Destination" (427) failed the pre-execute phase and returned error code 0xC0202025.


After analysing I found in the DataFlow --> Excel destination --> Advanced Editor for Excel Destination, the default data type for txtRemarks shows as "Unicode string [DT_WSTR]". But this is supposed to be "Unicode text stream [DT_NTEXT]". Even if I change the data type in the design time, It doesn't accept.

Please do help me out.

thanks
Sanra

View 4 Replies View Related

Import Data From Excel-Sheet Via OleDb In VB.Net - How To Get A Columns Data As String?

Oct 25, 2007

Hello,

i want to import data from an excel sheet into a database. While reading from the excel sheet OleDb automatically guesses the Datatype of each column. My Problem is the first A Column which contains ~240 Lines. 210 Lines are Numbers, the latter 30 do contain strings. When i use this code:







Code BlockDim sConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & conf_path_current & file_to_import & ";Extended Properties=""Excel 8.0;HDR=NO"""
Dim oConn As New OleDb.OleDbConnection(sConn)
Dim cmd1 As New System.Data.OleDb.OleDbCommand("Select * From [Table$]", oConn)
Dim rdr As OleDb.OleDbDataReader = cmd1.ExecuteReader
Do While rdr.Read()
Console.WriteLine(rdr.Item(0)) 'or rdr(0).ToString
Next




it will continue to read the stuff till the String-Lines are coming.
when using Item(0), it just crashes for trying to convert a DBNull to a String, when using rdr(0).ToString() it just gives me no value.

So my question is how to tell OleDB that i want that column to be completly read as String/Varchar?

Thanks for Reading

- Pierre from Berlin


[seems i got redirected into the wrong forum, please move into the correct one]

View 1 Replies View Related

Power Pivot :: Merging Static Excel Data With Dynamic Data?

Aug 19, 2015

I have some data in Excel - sheet1 which would be static.

Now I need to import data from SQL Server (using a query) and Union above static data with this SQL data and later I will have to create PowerPivot table in Sheet2.

Which is suitable option for me to import data from SQL to excel as I see "From SQL Server" option under "Data" and "Power Query" tab as well.

How to merge above SQL data with existing static data?

(SQL Server 2012)

View 6 Replies View Related

Exterpise Manager Select Export (ASCII,Excel,Access)?

Nov 8, 2004

Hi All. A client needs to send me some sample data. He has insisted he can query the table in Enterprise Manager via a simple select... "Select * from Table1"...

Now I need to get the data in some simple form (ASCII, Excel, Access, etc.) sent to me.

Can someone please provide me the info so I can pass it on for him to query a table from Enterprise Manager and "export it" to a simple file so I can receive it.

ANY THOUGHTS would be helpfull and GREATLY Appreciated!

Thanks.

Bill

View 3 Replies View Related

Reporting Services :: SSRS Export To Excel Showing Data Type As General For All Data Types

Sep 16, 2015

One of my report has different data types like decimal,percentage and integer values.

When I exported the report to excel , all the values are showing as "general" data type.

How to get excel data type same as ssrs report data type by default when exported to excel?

View 2 Replies View Related

Transfer Data From An Excel Sheet To Table In Sql Data Base

Nov 15, 2006

I have an excel sheet that contain colummns as in a table in a sql database i want to transfer this data from the sheet to the table frombusiness logic code layer not from the enterprise manager by wizardwhat can i do?? ...please urgent

View 1 Replies View Related

Transact SQL :: Excel Data Import Truncate Data Length To 255

Jul 29, 2015

I am trying to import data from an excel Sheet to SQL Database using OPENROWSET. After import I found that all the cells containing data of more than 2000 length got truncated to  255 characters only. I tried finding the solution and found that We need to have the data with length more than 255 in first 8 rows of Excel sheet. It worked for me also. But In real scenario the data that I cant do the manual work on excel. I tried out with Dot Net utility and SSIS package also but the truncation is still the issue.

INSERT into tmp_Test
SELECT
*
FROM
OPENROWSET('Microsoft.ACE.OLEDB.12.0','Excel
12.0;Database=D:Book1.xlsx', [Sheet1$])

View 9 Replies View Related

Data Format Issue While Importing Data From Excel To SQL

Jul 17, 2007

hi



when i m importing data from excel to Sql using DTS the column which has text content was not imported as same in excel sheet. whereas a special character is appearing in between the lines. the text field contains multiple lines but the conetent is imported in single line .

ex:









ARIZONA
ALABAMA
STATE


but i m getting imported

as :
ARIZONA ALABAMA STATE

How to Format a single column while importing?



Regards

Raj

View 1 Replies View Related

Transact SQL :: Execute Select Query By Fetching Results Form Excel Sheet?

Jul 9, 2015

I am trying to fetch records from excel sheet using Select Query but I am getting the error message saying

"Msg 7302, Level 16, State 1, Line 1
Cannot create an instance of OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)"."
Here is my Query,
sp_configure 'show advanced options',1
reconfigure with override
go
sp_configure 'Ad Hoc Distributed Queries',1
reconfigure with override
go
reconfigure
SELECT *
FROM OPENROWSET
('Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;Database=C:M2MworkedworkedBOS.xlsx;HDR=YES', 'select * from [Sheet1$]') AS A;

View 5 Replies View Related

How Can I Specify The Data Type When Importing Excel Data Via DTS?

Jun 11, 2006

I'm new to SQL and DTS packages. I am trying to import data from an excel spreadsheet to an SQL server table via DTS package. It seems that the excel task looks at the first few records in a column to determine the datatype for that column. If the first few records are text, the entire column is imported as text. If numeric, the entire column is imported as numeric.
There are about 25,000 records. In one field, the most important one, about half of the records begin with letters and the rest are all numbers. It is the subscriber ID field, and some subscriber IDs are all numbers, some are letters and numbers. The entire column should be imported as text. However, when I run the transform data task from the excel connection, none of the records that are all numbers are imported. I end up correctly importing only 13,000 of the 25,000 records. The rest are imported with the subscriberID field as <NULL>.
I tried using the CAST or CONVERT function in the SQL query, but get the error message "Undefined Function."

Can anyone give me some help? Thanks,
Jim

View 4 Replies View Related

Import Data From Excel Data Sheets

Jan 6, 2007

Hello

Looks like I'am the first one to pop this forum!

But I'am a forward guy so lets get to the problem.


A problem with my replication system as occured.

I have a working SQL server that can do replication trough internet, everyting works

The problem is when I try to import large amount of data (10000 rows) to my database on the SQL server

the subscriber on my client don't get the rows. That will say imported data is not being replicated.

only rows that i have manually inserted will be replicated.

I used the import wizard that came with SQL server.

Is there a solution to this problem?

View 5 Replies View Related

Import Excel Data - Missing Data

Mar 4, 2008

Hello all, I am using the Import Wizard to pull in data from an Excel spreadsheet. One column in particular SQL Server sees as a float data type but it contains varchar data. So I change this in the wizard but some of these values are missing when I select * from Sheet1$ in SQL Server 2005. Any ideas why this would happen? I have formatted the particular column as text in Excel.

View 6 Replies View Related

Import Data From Excel Data Sheets

Jan 6, 2007

Hello

A problem with my replication system as occured.

I have a working SQL server that can do replication trough internet, everyting works

The problem is when I try to import large amount of data (10000 rows) to my database on the SQL server

the subscriber on my client don't get the rows. That will say imported data is not being replicated.

only rows that i have manually inserted will be replicated.

I used the import wizard that came with SQL server.

Is there a solution to this problem?

 

View 7 Replies View Related

Excel Data Mining Add-in For Categorical Data

Jul 24, 2007

Hi my friends,

I do have a problem with results of clustering algorithm with my categorical data.
In reality I have a big table with one's and zero's and I try to cluster according to 60 attributes.
I tries to cluster to two categories many times but I get only one cluster. What do you suggest. Which values can I change to the algorithm? Is there anything particular for categorical data ?

Thank for your help in advance.

Manolis

View 3 Replies View Related

Excel Data Mining Add-in For Categorical Data

Aug 5, 2007

Thank you very much for your previous answers conserning clustering algorithm.

I change a bit my data and now I can get two and three clusters as I wish.
But now I have a different question. I wish to keep my Structure and Model for further trials with different algorithm values, like cardinality. I tried the following
I selected in excel Data Mining and then the option cluster button.
Then in the cluster wizard I chose analysis service data source and I reform the query as I need adding only at the end
where "STAFF_YES" = 1. Then I choose the needed columns and target value. Finally I select browse model, enable drill through only and I finish the wizard and get some results, rather good. But i need to try again with different parameters.
I tried Business intelligent Studio to check my Analysis service. The structure were here but when I changed any parameter and I tried to reprocess I got the following messages


Processing Mining Structure 'try Structure_1' completed successfully.
Start time: 5/8/2007 4:55:08 μμ; End time: 5/8/2007 4:55:08 μμ; Duration: 0:00:00
Processing Dimension 'try Structure_1 ~MC-__RowIndex' completed successfully.
Start time: 5/8/2007 4:55:08 μμ; End time: 5/8/2007 4:55:08 μμ; Duration: 0:00:00
Processing Dimension Attribute '(All)' completed successfully.
Start time: 5/8/2007 4:55:08 μμ; End time: 5/8/2007 4:55:08 μμ; Duration: 0:00:00
Processing Dimension Attribute 'EPI_CELL_SINO_GOOD' completed successfully.
Start time: 5/8/2007 4:55:08 μμ; End time: 5/8/2007 4:55:08 μμ; Duration: 0:00:00
Processing Dimension Attribute 'EPI_CELL_SINO_LOOSE' completed successfully.
Start time: 5/8/2007 4:55:08 μμ; End time: 5/8/2007 4:55:08 μμ; Duration: 0:00:00
Errors and Warnings from Response
Internal error: The operation terminated unsuccessfully.
Internal error: The operation terminated unsuccessfully.
Internal error: An unexpected error occurred (file 'pcprocbinding.cpp', line 6645, function 'PCDBProcBinding:electOrChangeCartridge').
Errors in the OLAP storage engine: An error occurred while the dimension, with the ID of 'try Structure_1 ~MC-__RowIndex', Name of 'try Structure_1 ~MC-__RowIndex' was being processed.
Errors in the OLAP storage engine: An error occurred while the 'EPI_CELL_SINO_LOOSE' attribute of the 'try Structure_1 ~MC-__RowIndex' dimension from the 'DMAddinsDB2' database was being processed.
Internal error: The operation terminated unsuccessfully.
Internal error: The operation terminated unsuccessfully.
Internal error: An unexpected error occurred (file 'pcprocbinding.cpp', line 6645, function 'PCDBProcBinding:electOrChangeCartridge').
Errors in the OLAP storage engine: An error occurred while the dimension, with the ID of 'try Structure_1 ~MC-__RowIndex', Name of 'try Structure_1 ~MC-__RowIndex' was being processed.
Errors in the OLAP storage engine: An error occurred while the 'EPI_CELL_SINO_GOOD' attribute of the 'try Structure_1 ~MC-__RowIndex' dimension from the 'DMAddinsDB2' database was being processed.

And no change to the structure take place.

Please help me if you can
Thank you in advnce
Best regards.
Manolis

View 1 Replies View Related

'Select Top 10 * ...' Returns Data But 'Select * ..' Does Not

Dec 7, 2006

HiI have a query that is performing very strangely.I f I put a top statement in it returns rows,soSelect top 10 * from .......returns 10 rowsbut without it then no data is returnedSelect * from ..........returns 0 rows.

View 1 Replies View Related

Data Mining :: MS Excel Data Mining Add-ins / Maximum Number Of Predict Columns

Jun 4, 2015

Having successfully created :

- a data mining structure with about 80 columns.
- a data mining model using Microsoft_Decision_Trees with 2 prediction columns. 

I thought I would then explore the possibility of have more than 2 prediction columns, in this case 20.

I get an error message and I can't work out :
a) if this is because there's a limit to the maximum number of prediction columns and where that maximum is stated.
b) if something else has become corrupted
c) there's a know bug and if the error message is either meaningful or not.

Either way, I'm unable to complete the data mining wizard 

The error message is :Errors in the metadata manager. Either the mining structure with the ID of '[my model Structure]' does not exist in the database with the ID of 'DMAddinsDB', or the user does not have permissions to access the object.

View 3 Replies View Related

Insert Data To A Table Where Select Data From Another SERVER

Oct 8, 2007

I had a function like below :Public Sub Getdata2(ByVal query, ByVal db, ByVal name)
Dim selectSQL As StringDim con As SqlConnection
Dim cmd As SqlCommand
Dim reader As SqlDataReader
Trycon = New SqlConnection("User ID=xxx;password=xxx;persist security info=True;Initial Catalog=database1;Data Source=xxx.xxx.xxx.xxx.xxx,xxxxx;")
Dim username As String
username = Request.QueryString("username")
selectSQL = "SET DATEFORMAT DMY;Insert into table1(hse_num, st_name, proj_name, unit_num, postal, n_postal, flr_area, flr_sf, flr_rate, flr_ra_sf, land_area, land_sf, land_rate, lnd_ra_sf, prop_code, cont_date, title, sisv_ref, r_date, rec_num, source, username, DGP, Remarks, Sub_Code, caveat, consider, age) select hse_num, st_name, proj_name, unit_num, postal, n_postal, flr_area, flr_sf, flr_rate, flr_ra_sf, land_area, land_sf, land_rate, lnd_ra_sf, prop_code, cont_date, title, sisv_ref, r_date, rec_num, source, '" & username & "', DGP, Remarks, Sub_Code, caveat, consider, age from [yyy.yyy.yyy.yyy,yyyy].database2.dbo.table2 where " & querycmd = New SqlCommand(selectSQL, con)
con.Open()
reader = cmd.ExecuteReader()
lbl.Text = selectSQLCatch ex As Exception
lbl.Text = ex.Message
Finally
If (Not con Is Nothing) Then
con.Close()
con.Dispose()
End If
End Try
End Sub
'------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 
May i know that how do i retrieve data from  [yyy.yyy.yyy.yyy,yyyy].database2.dbo.table2 due to diffrent server, diffrent UID and Password
 

View 1 Replies View Related

How To Import Data From Excel Into MS SQL In .Net?

Jun 15, 2007

Hi, I'm building a web application in VB.NET 1.1 where users will upload Excel files at this webpage and the web application will transfer the data from the uploaded Excel file into MS SQL 2000. There are around 600-700 records and about 56 columns in the Excel file which is to be uploaded daily. There will be a few different files which I need to implement for as well.
 I've sourced for and tried alot of methods. But either they can't satisfy my requirements or they just can't simply work.
- Most simple and direct way I've tried is creating a oledb connection to the Excel file in the following codes...
Function TestUploadData1(ByVal vFile As String) As String    Dim Oleda As System.Data.OleDb.OleDbDataAdapter    Dim Olecn As System.Data.OleDb.OleDbConnection    Dim dt1 As DataTable
   Olecn = New System.Data.OleDb.OleDbConnection( _ "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=" & vFile & ";" & _ "Extended Properties=Excel 8.0;HDR=Yes")    Olecn.Open()
   Dim ExcelCommand As New System.Data.OleDb.OleDbCommand("SELECT INTO [ODBC;Driver={SQL Server};Server=(local);Database=dbSSC;Trusted_Conn ection=yes].[tblOutstanding] FROM [Report$];", Olecn)    ExcelCommand.ExecuteNonQuery()
   Olecn.Close() End Function
But from the above codes I kept getting the error "Could not find installable ISAM." at the line Olecn.Open(). I've tried to set the registry to C:WindowsSystem32msexcl40.dll but to no avail...
- I've tried another method using the OpenRowSet in the following codes Function TestUploadData2(ByVal vFile As String) As String    Dim cn As SqlConnection    Dim cm As SqlCommand    Dim strSQL As String cn = New SqlConnection("server=localhost; user ID=accessSSC; password=accessSSC541; database=dbSSC")
   cn.Open()
   strSQL = "INSERT INTO tblOutstanding SELECT * FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0','Excel 8.0;Database=" & vFile & ";HDR=Yes','SELECT * FROM [Report$]')"    cm = New SqlCommand(strSQL, cn)    cm.ExecuteNonQuery()
   cn.Close() End Function
For the above codes, I kept getting the error "Ad hoc access to OLE DB provider 'Microsoft.Jet.OLEDB.4.0' has been denied. You must access this provider through a linked server." at the line cm.ExecuteNonQuery() and I've tried to disable the Ad Hoc settings in the registry and tried to create a link server but to no avail as well...
- I've tried DTS but I'd need to DTS package to run whenever the users upload a file. Is there an easy way that I can run the designated DTS package to run through my .Net web application?
Any help would be deeply appreciated. Thanks & Regards, Keith Chang

View 8 Replies View Related

Data Trasfer To Excel

Apr 21, 2008

I would like to transfer the data that i retrieved from the sql server 2005 to gridview and save the data displayed on the gridview to a excel sheet. Is there any tutorial or articals regarding this topic. I know this is not really the topic that belongs here but i could not find any more appropriate place. Any help will be much appreciated.
Thanks
Kabir
 

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved