Ask a Question related to ASP Database, Design and Development.
-
midwesthills #1
Move data from Excel to SQL Server via ASP
I'm trying to import data from an Excel spreadsheet, and write it into
a SQL Server database. I know how to read the data from Excel and how
to write the data to SQL Server. The part I'm struggling with is
moving the data from Excel to the DB. I'd like to just open a
recordset from Excel, then write that same recordset to the DB-- just
not sure how that's done. I've tried it a couple different ways with
no luck. Could someone please give me some guidance on this? Thank
you in advance for the help!
midwesthills Guest
-
Import excel data into SQL server -- ASP.net, C#, DTS -- how??
I want to set up the import of data from an excel file into SQL Server from my ASP.net (C#) application. The user will select the file that needs... -
Web Services a Secure Way to Move Student Data
Many departments rely on our department for reports and such. Often these reports will contain confidential data like student-ids and social... -
Best way to get ASP page to query Excel data (using SQL server)?
Hi, I plan to query and process some data that resides in an Excel file on a network drive via ASP, with a SQL Server database as a go-between.... -
Best way to move data across multiple pages?
I am trying to build a few pages basically emulating a wizard that you might find in a Windows product. A few fields to fill out on one page, move... -
Extending client to access Excel files (most data still in SQL Server)
We are building a general query tool for accessing data in our company. The primary data source we access is SQL Server running on a remote host,... -
David Morgan #2
Re: Move data from Excel to SQL Server via ASP
If the Excel file will always be the same structure, (and after some
preliminary checks to make sure it is etc.), set-up a DTS package and then
execute it when desired from ASP.
If you save the DTS package as a job, (from memory... )... you will be able
to execute it using sp_execute_job.
From my system where I do this:
objConn.Execute "usp_ImportPayslipsDTS", , adExecuteNoRecords +
adCmdStoredProc
CREATE Procedure usp_ImportPayslipsDTS
As
set nocount on
EXEC msdb.dbo.sp_start_job @job_name = 'Payslips Import'
return
"midwesthills" <midwesthills@hotmail.com> wrote in message
news:1f28b412.0408020548.1388b938@posting.google.c om...> I'm trying to import data from an Excel spreadsheet, and write it into
> a SQL Server database. I know how to read the data from Excel and how
> to write the data to SQL Server. The part I'm struggling with is
> moving the data from Excel to the DB. I'd like to just open a
> recordset from Excel, then write that same recordset to the DB-- just
> not sure how that's done. I've tried it a couple different ways with
> no luck. Could someone please give me some guidance on this? Thank
> you in advance for the help!
David Morgan Guest
-
midwesthills #3
Re: Move data from Excel to SQL Server via ASP
For of all, thanks for the advice. I'm not too fimiliar with DTS
packages, but was able to create one using the GUI provided in
Enterprise Manager.
I'm not sure what you meant by saving the package as a job. I tried
saving it as a package in SQL Server and as a VB file, but can't call
it from a stored procudure using the EXEC command. What am I missing?
Could you please elaborate? Thanks again!!!
"David Morgan" <david@davidmorgan.me.uk> wrote in message news:<uWtR97NeEHA.3864@TK2MSFTNGP10.phx.gbl>...> If the Excel file will always be the same structure, (and after some
> preliminary checks to make sure it is etc.), set-up a DTS package and then
> execute it when desired from ASP.
>
> If you save the DTS package as a job, (from memory... )... you will be able
> to execute it using sp_execute_job.
>
> From my system where I do this:
>
> objConn.Execute "usp_ImportPayslipsDTS", , adExecuteNoRecords +
> adCmdStoredProc
>
>
> CREATE Procedure usp_ImportPayslipsDTS
> As
> set nocount on
> EXEC msdb.dbo.sp_start_job @job_name = 'Payslips Import'
> return
>
>
>
>
> "midwesthills" <midwesthills@hotmail.com> wrote in message
> news:1f28b412.0408020548.1388b938@posting.google.c om...> > I'm trying to import data from an Excel spreadsheet, and write it into
> > a SQL Server database. I know how to read the data from Excel and how
> > to write the data to SQL Server. The part I'm struggling with is
> > moving the data from Excel to the DB. I'd like to just open a
> > recordset from Excel, then write that same recordset to the DB-- just
> > not sure how that's done. I've tried it a couple different ways with
> > no luck. Could someone please give me some guidance on this? Thank
> > you in advance for the help!midwesthills Guest
-
Bob Barrows [MVP] #4
Re: Move data from Excel to SQL Server via ASP
midwesthills wrote:
Go to [url]www.sqldts.com[/url] where you will find various articles describing how to> For of all, thanks for the advice. I'm not too fimiliar with DTS
> packages, but was able to create one using the GUI provided in
> Enterprise Manager.
>
> I'm not sure what you meant by saving the package as a job. I tried
> saving it as a package in SQL Server and as a VB file, but can't call
> it from a stored procudure using the EXEC command. What am I missing?
> Could you please elaborate? Thanks again!!!
>
execute packages from stored procedures, asp, etc.
Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Bob Barrows [MVP] Guest
-
David Morgan #5
Re: Move data from Excel to SQL Server via ASP
Schedule DTS Package for Later Execution - Any time, will remove it later.
Save DTS Package - SQL Server
Give the package a name etc.
Go to Management \ SQL Server Agent \ Jobs
Double click your job that appears there, switch to Schedules and delete the
schedule.
Then you can use the sp_start_job proc as below.
"midwesthills" <midwesthills@hotmail.com> wrote in message
news:1f28b412.0408030357.a4e30fc@posting.google.co m...news:<uWtR97NeEHA.3864@TK2MSFTNGP10.phx.gbl>...> For of all, thanks for the advice. I'm not too fimiliar with DTS
> packages, but was able to create one using the GUI provided in
> Enterprise Manager.
>
> I'm not sure what you meant by saving the package as a job. I tried
> saving it as a package in SQL Server and as a VB file, but can't call
> it from a stored procudure using the EXEC command. What am I missing?
> Could you please elaborate? Thanks again!!!
>
>
>
> "David Morgan" <david@davidmorgan.me.uk> wrote in messagethen> > If the Excel file will always be the same structure, (and after some
> > preliminary checks to make sure it is etc.), set-up a DTS package andable> > execute it when desired from ASP.
> >
> > If you save the DTS package as a job, (from memory... )... you will be> > to execute it using sp_execute_job.
> >
> > From my system where I do this:
> >
> > objConn.Execute "usp_ImportPayslipsDTS", , adExecuteNoRecords +
> > adCmdStoredProc
> >
> >
> > CREATE Procedure usp_ImportPayslipsDTS
> > As
> > set nocount on
> > EXEC msdb.dbo.sp_start_job @job_name = 'Payslips Import'
> > return
> >
> >
> >
> >
> > "midwesthills" <midwesthills@hotmail.com> wrote in message
> > news:1f28b412.0408020548.1388b938@posting.google.c om...> > > I'm trying to import data from an Excel spreadsheet, and write it into
> > > a SQL Server database. I know how to read the data from Excel and how
> > > to write the data to SQL Server. The part I'm struggling with is
> > > moving the data from Excel to the DB. I'd like to just open a
> > > recordset from Excel, then write that same recordset to the DB-- just
> > > not sure how that's done. I've tried it a couple different ways with
> > > no luck. Could someone please give me some guidance on this? Thank
> > > you in advance for the help!
David Morgan Guest
-
midwesthills #6
Re: Move data from Excel to SQL Server via ASP
Is this better than using DTS.Package object to step through the
package? Does either method inheriently use transactions, or do I
need to code that in as well?
Thanks! You've been a great help!!!
"David Morgan" <david@davidmorgan.me.uk> wrote in message news:<u$oJFSVeEHA.3944@tk2msftngp13.phx.gbl>...> Schedule DTS Package for Later Execution - Any time, will remove it later.
> Save DTS Package - SQL Server
>
> Give the package a name etc.
>
> Go to Management \ SQL Server Agent \ Jobs
>
> Double click your job that appears there, switch to Schedules and delete the
> schedule.
>
> Then you can use the sp_start_job proc as below.
>
>
>
> "midwesthills" <midwesthills@hotmail.com> wrote in message
> news:1f28b412.0408030357.a4e30fc@posting.google.co m...> news:<uWtR97NeEHA.3864@TK2MSFTNGP10.phx.gbl>...> > For of all, thanks for the advice. I'm not too fimiliar with DTS
> > packages, but was able to create one using the GUI provided in
> > Enterprise Manager.
> >
> > I'm not sure what you meant by saving the package as a job. I tried
> > saving it as a package in SQL Server and as a VB file, but can't call
> > it from a stored procudure using the EXEC command. What am I missing?
> > Could you please elaborate? Thanks again!!!
> >
> >
> >
> > "David Morgan" <david@davidmorgan.me.uk> wrote in message> then> > > If the Excel file will always be the same structure, (and after some
> > > preliminary checks to make sure it is etc.), set-up a DTS package and> able> > > execute it when desired from ASP.
> > >
> > > If you save the DTS package as a job, (from memory... )... you will be> > > to execute it using sp_execute_job.
> > >
> > > From my system where I do this:
> > >
> > > objConn.Execute "usp_ImportPayslipsDTS", , adExecuteNoRecords +
> > > adCmdStoredProc
> > >
> > >
> > > CREATE Procedure usp_ImportPayslipsDTS
> > > As
> > > set nocount on
> > > EXEC msdb.dbo.sp_start_job @job_name = 'Payslips Import'
> > > return
> > >
> > >
> > >
> > >
> > > "midwesthills" <midwesthills@hotmail.com> wrote in message
> > > news:1f28b412.0408020548.1388b938@posting.google.c om...
> > > > I'm trying to import data from an Excel spreadsheet, and write it into
> > > > a SQL Server database. I know how to read the data from Excel and how
> > > > to write the data to SQL Server. The part I'm struggling with is
> > > > moving the data from Excel to the DB. I'd like to just open a
> > > > recordset from Excel, then write that same recordset to the DB-- just
> > > > not sure how that's done. I've tried it a couple different ways with
> > > > no luck. Could someone please give me some guidance on this? Thank
> > > > you in advance for the help!midwesthills Guest
-
David Morgan #7
Re: Move data from Excel to SQL Server via ASP
No, it's no better, and all it does is kick off the process. It does not
wait for it to finish and only can only return the result of submitting the
job.
Go for the sqldts.com approach if you wish, I did, but decided that I didn't
need all of that stuff and I think permissions caused me a few probs. Not
sure if the article on the website covers permissions but I would be
surprised if the I_USR account was allowed to execute the DTS Objects.
I would imagine that both methods use transactions. I would not bother
coding it in as I am sure DTS rolls back on failure although I am not
certain.
"midwesthills" <midwesthills@hotmail.com> wrote in message
news:1f28b412.0408031159.bec18b5@posting.google.co m...news:<u$oJFSVeEHA.3944@tk2msftngp13.phx.gbl>...> Is this better than using DTS.Package object to step through the
> package? Does either method inheriently use transactions, or do I
> need to code that in as well?
>
> Thanks! You've been a great help!!!
>
>
>
> "David Morgan" <david@davidmorgan.me.uk> wrote in messagelater.> > Schedule DTS Package for Later Execution - Any time, will remove itthe> > Save DTS Package - SQL Server
> >
> > Give the package a name etc.
> >
> > Go to Management \ SQL Server Agent \ Jobs
> >
> > Double click your job that appears there, switch to Schedules and deleteand> > schedule.
> >
> > Then you can use the sp_start_job proc as below.
> >
> >
> >
> > "midwesthills" <midwesthills@hotmail.com> wrote in message
> > news:1f28b412.0408030357.a4e30fc@posting.google.co m...> > news:<uWtR97NeEHA.3864@TK2MSFTNGP10.phx.gbl>...> > > For of all, thanks for the advice. I'm not too fimiliar with DTS
> > > packages, but was able to create one using the GUI provided in
> > > Enterprise Manager.
> > >
> > > I'm not sure what you meant by saving the package as a job. I tried
> > > saving it as a package in SQL Server and as a VB file, but can't call
> > > it from a stored procudure using the EXEC command. What am I missing?
> > > Could you please elaborate? Thanks again!!!
> > >
> > >
> > >
> > > "David Morgan" <david@davidmorgan.me.uk> wrote in message> > > > If the Excel file will always be the same structure, (and after some
> > > > preliminary checks to make sure it is etc.), set-up a DTS packagebe> > then> > > > execute it when desired from ASP.
> > > >
> > > > If you save the DTS package as a job, (from memory... )... you willinto> > able> > > > to execute it using sp_execute_job.
> > > >
> > > > From my system where I do this:
> > > >
> > > > objConn.Execute "usp_ImportPayslipsDTS", , adExecuteNoRecords +
> > > > adCmdStoredProc
> > > >
> > > >
> > > > CREATE Procedure usp_ImportPayslipsDTS
> > > > As
> > > > set nocount on
> > > > EXEC msdb.dbo.sp_start_job @job_name = 'Payslips Import'
> > > > return
> > > >
> > > >
> > > >
> > > >
> > > > "midwesthills" <midwesthills@hotmail.com> wrote in message
> > > > news:1f28b412.0408020548.1388b938@posting.google.c om...
> > > > > I'm trying to import data from an Excel spreadsheet, and write ithow> > > > > a SQL Server database. I know how to read the data from Excel andjust> > > > > to write the data to SQL Server. The part I'm struggling with is
> > > > > moving the data from Excel to the DB. I'd like to just open a
> > > > > recordset from Excel, then write that same recordset to the DB--with> > > > > not sure how that's done. I've tried it a couple different waysThank> > > > > no luck. Could someone please give me some guidance on this?> > > > > you in advance for the help!
David Morgan Guest



Reply With Quote

