Showing posts with label file. Show all posts
Showing posts with label file. Show all posts

Thursday, March 29, 2012

Drag and drop query onto Management Studio

Everytime I drag and drop a query file (.sql) from Windows Explorer onto
Management Studio, I am prompted to login. How do I get drag and drop to use
existing connection?
guy,
Install SP2 I believe. (At least it works for me.)
RLF
"guy" <guy@.hotmail.com> wrote in message
news:OiHKPyJqHHA.4872@.TK2MSFTNGP03.phx.gbl...
> Everytime I drag and drop a query file (.sql) from Windows Explorer onto
> Management Studio, I am prompted to login. How do I get drag and drop to
> use existing connection?
>
|||That"s the ticket. Thank you.
"Russell Fields" <russellfields@.nomail.com> wrote in message
news:OGnQpwRqHHA.3740@.TK2MSFTNGP02.phx.gbl...
> guy,
> Install SP2 I believe. (At least it works for me.)
> RLF
> "guy" <guy@.hotmail.com> wrote in message
> news:OiHKPyJqHHA.4872@.TK2MSFTNGP03.phx.gbl...
>

Tuesday, March 27, 2012

Downsizing to Access?

Hi,
Does anyone happen to know if it is possible to downsize a SQL Server
database to an Access mdb file? The reason I ask is because I want to use an
mdb file to transport the SQL Server database from a to b, and then upsize
the mdb database to SQL Server.
Unless there is an easier way to transport SQL Server databases including
views and stored procedures?
Thanks all
SimonTry sp_detach_db and sp_attach_db.
--
Geoff N. Hiten
Microsoft SQL Server MVP
Senior Database Administrator
Careerbuilder.com
"Simon Harvey" <simon.harvey@.the-web-works.co.uk> wrote in message
news:%23Lik0fo5DHA.2380@.TK2MSFTNGP10.phx.gbl...
> Hi,
> Does anyone happen to know if it is possible to downsize a SQL Server
> database to an Access mdb file? The reason I ask is because I want to use
an
> mdb file to transport the SQL Server database from a to b, and then upsize
> the mdb database to SQL Server.
> Unless there is an easier way to transport SQL Server databases including
> views and stored procedures?
> Thanks all
> Simon
>|||Look into sp_detach_db and sp_attach_db in BOL.
This will allow you to transport the db with ease.
-Lars
"Simon Harvey" <simon.harvey@.the-web-works.co.uk> wrote in message
news:%23Lik0fo5DHA.2380@.TK2MSFTNGP10.phx.gbl...
> Hi,
> Does anyone happen to know if it is possible to downsize a SQL Server
> database to an Access mdb file? The reason I ask is because I want to use
an
> mdb file to transport the SQL Server database from a to b, and then upsize
> the mdb database to SQL Server.
> Unless there is an easier way to transport SQL Server databases including
> views and stored procedures?
> Thanks all
> Simon
>|||Attach, detach does NOT work to copy SQL databases into an access MDB unless
I have really missed the boat... I would probably use DTS and pick sql as
the source and Access as the destination...
--
Wayne Snyder MCDBA, SQL Server MVP
Computer Education Services Corporation (CESC), Charlotte, NC
(Please respond only to the newsgroups.)
I support the Professional Association for SQL Server
(www.sqlpass.org)
"Simon Harvey" <simon.harvey@.the-web-works.co.uk> wrote in message
news:#Lik0fo5DHA.2380@.TK2MSFTNGP10.phx.gbl...
> Hi,
> Does anyone happen to know if it is possible to downsize a SQL Server
> database to an Access mdb file? The reason I ask is because I want to use
an
> mdb file to transport the SQL Server database from a to b, and then upsize
> the mdb database to SQL Server.
> Unless there is an easier way to transport SQL Server databases including
> views and stored procedures?
> Thanks all
> Simon
>|||From your question is sounded like you were trying to transfer a database
from one MSSQL server to another using an Access database as the transfer
media. If that is the case then I would ditch using Access and just detach
the database from the source, copy to the destination and re-attach the
database.
Jim
"Wayne Snyder" <wsnyder@.ikon.com> wrote in message
news:uDorHDp5DHA.2300@.TK2MSFTNGP10.phx.gbl...
> Attach, detach does NOT work to copy SQL databases into an access MDB
unless
> I have really missed the boat... I would probably use DTS and pick sql as
> the source and Access as the destination...
> --
> Wayne Snyder MCDBA, SQL Server MVP
> Computer Education Services Corporation (CESC), Charlotte, NC
> (Please respond only to the newsgroups.)
> I support the Professional Association for SQL Server
> (www.sqlpass.org)
> "Simon Harvey" <simon.harvey@.the-web-works.co.uk> wrote in message
> news:#Lik0fo5DHA.2380@.TK2MSFTNGP10.phx.gbl...
> > Hi,
> >
> > Does anyone happen to know if it is possible to downsize a SQL Server
> > database to an Access mdb file? The reason I ask is because I want to
use
> an
> > mdb file to transport the SQL Server database from a to b, and then
upsize
> > the mdb database to SQL Server.
> >
> > Unless there is an easier way to transport SQL Server databases
including
> > views and stored procedures?
> >
> > Thanks all
> >
> > Simon
> >
> >
>

Downsizing to Access?

Hi,
Does anyone happen to know if it is possible to downsize a SQL Server
database to an Access mdb file? The reason I ask is because I want to use an
mdb file to transport the SQL Server database from a to b, and then upsize
the mdb database to SQL Server.
Unless there is an easier way to transport SQL Server databases including
views and stored procedures?
Thanks all
SimonTry sp_detach_db and sp_attach_db.
Geoff N. Hiten
Microsoft SQL Server MVP
Senior Database Administrator
Careerbuilder.com
"Simon Harvey" <simon.harvey@.the-web-works.co.uk> wrote in message
news:%23Lik0fo5DHA.2380@.TK2MSFTNGP10.phx.gbl...
quote:

> Hi,
> Does anyone happen to know if it is possible to downsize a SQL Server
> database to an Access mdb file? The reason I ask is because I want to use

an
quote:

> mdb file to transport the SQL Server database from a to b, and then upsize
> the mdb database to SQL Server.
> Unless there is an easier way to transport SQL Server databases including
> views and stored procedures?
> Thanks all
> Simon
>
|||Look into sp_detach_db and sp_attach_db in BOL.
This will allow you to transport the db with ease.
-Lars
"Simon Harvey" <simon.harvey@.the-web-works.co.uk> wrote in message
news:%23Lik0fo5DHA.2380@.TK2MSFTNGP10.phx.gbl...
quote:

> Hi,
> Does anyone happen to know if it is possible to downsize a SQL Server
> database to an Access mdb file? The reason I ask is because I want to use

an
quote:

> mdb file to transport the SQL Server database from a to b, and then upsize
> the mdb database to SQL Server.
> Unless there is an easier way to transport SQL Server databases including
> views and stored procedures?
> Thanks all
> Simon
>
|||Attach, detach does NOT work to copy SQL databases into an access MDB unless
I have really missed the boat... I would probably use DTS and pick sql as
the source and Access as the destination...
Wayne Snyder MCDBA, SQL Server MVP
Computer Education Services Corporation (CESC), Charlotte, NC
(Please respond only to the newsgroups.)
I support the Professional Association for SQL Server
(www.sqlpass.org)
"Simon Harvey" <simon.harvey@.the-web-works.co.uk> wrote in message
news:#Lik0fo5DHA.2380@.TK2MSFTNGP10.phx.gbl...
quote:

> Hi,
> Does anyone happen to know if it is possible to downsize a SQL Server
> database to an Access mdb file? The reason I ask is because I want to use

an
quote:

> mdb file to transport the SQL Server database from a to b, and then upsize
> the mdb database to SQL Server.
> Unless there is an easier way to transport SQL Server databases including
> views and stored procedures?
> Thanks all
> Simon
>
|||From your question is sounded like you were trying to transfer a database
from one MSSQL server to another using an Access database as the transfer
media. If that is the case then I would ditch using Access and just detach
the database from the source, copy to the destination and re-attach the
database.
Jim
"Wayne Snyder" <wsnyder@.ikon.com> wrote in message
news:uDorHDp5DHA.2300@.TK2MSFTNGP10.phx.gbl...
quote:

> Attach, detach does NOT work to copy SQL databases into an access MDB

unless
quote:

> I have really missed the boat... I would probably use DTS and pick sql as
> the source and Access as the destination...
> --
> Wayne Snyder MCDBA, SQL Server MVP
> Computer Education Services Corporation (CESC), Charlotte, NC
> (Please respond only to the newsgroups.)
> I support the Professional Association for SQL Server
> (www.sqlpass.org)
> "Simon Harvey" <simon.harvey@.the-web-works.co.uk> wrote in message
> news:#Lik0fo5DHA.2380@.TK2MSFTNGP10.phx.gbl...
use[QUOTE]
> an
upsize[QUOTE]
including[QUOTE]
>

Downloading Reporting services

Hello,
I have downloaded an eval version of Reporting services
from microsoft.com . But the file is corrupted and will
not run on my pc. Can any one help where can I get the
latest and greatest version other than microsoft.com ?
Thanks a lot for your help.
- SThis link details how you can get a version of RS besides downloading.
What problem were you seeing running the downloaded version?
--
-Daniel
This posting is provided "AS IS" with no warranties, and confers no rights.
"Sunil" <sunilor@.hotmail.com> wrote in message
news:244801c49cc6$44b5cf80$a401280a@.phx.gbl...
> Hello,
> I have downloaded an eval version of Reporting services
> from microsoft.com . But the file is corrupted and will
> not run on my pc. Can any one help where can I get the
> latest and greatest version other than microsoft.com ?
>
> Thanks a lot for your help.
> - S|||Forgot to post the link. :)
http://www.microsoft.com/sql/reporting/howtobuy/default.asp
--
-Daniel
This posting is provided "AS IS" with no warranties, and confers no rights.
"Sunil" <sunilor@.hotmail.com> wrote in message
news:244801c49cc6$44b5cf80$a401280a@.phx.gbl...
> Hello,
> I have downloaded an eval version of Reporting services
> from microsoft.com . But the file is corrupted and will
> not run on my pc. Can any one help where can I get the
> latest and greatest version other than microsoft.com ?
>
> Thanks a lot for your help.
> - S

Downloading File located in SQL Server with ASP

I have a SQL 2000 Standard server setup and I have a table in one of my
databases to store files in. I am using asp code to retrieve the files from
the database. I can download txt, bmp files just fine but when it comes to
pdf documents it just hangs at the downloading the file screen and then gives
me a timeout error after awhile. It is not a problem with the file sizes. I
am testing it with a 20 and 60k pdf files and one of the txt files I used to
test with is a few mb. I am thinking it's either an IIS server config issue
or SQL Server config problem. The IIS server is for our intranet and is not
locked down. Both IIS and SQL are running on the same box which is a Windows
2003 Enterprise server. Any help would be great.
Thanks,
Brett Bishop
MCSE, MCP+I
US Bankruptcy Court
"fibreiv" <fibreiv@.discussions.microsoft.com> wrote in message
news:0880684A-A141-4D78-842A-041C501DBCF5@.microsoft.com...
> I have a SQL 2000 Standard server setup and I have a table in one of my
> databases to store files in. I am using asp code to retrieve the files
from
> the database. I can download txt, bmp files just fine but when it comes
to
> pdf documents it just hangs at the downloading the file screen and then
gives
> me a timeout error after awhile. It is not a problem with the file sizes.
I
> am testing it with a 20 and 60k pdf files and one of the txt files I used
to
> test with is a few mb. I am thinking it's either an IIS server config
issue
> or SQL Server config problem. The IIS server is for our intranet and is
not
> locked down. Both IIS and SQL are running on the same box which is a
Windows
> 2003 Enterprise server. Any help would be great.
Can you access PDF files via URL from the file system?
|||fibreiv wrote:
> I have a SQL 2000 Standard server setup and I have a table in one of my
> databases to store files in. I am using asp code to retrieve the files from
> the database. I can download txt, bmp files just fine but when it comes to
> pdf documents it just hangs at the downloading the file screen and then gives
> me a timeout error after awhile. It is not a problem with the file sizes. I
> am testing it with a 20 and 60k pdf files and one of the txt files I used to
> test with is a few mb. I am thinking it's either an IIS server config issue
> or SQL Server config problem. The IIS server is for our intranet and is not
> locked down. Both IIS and SQL are running on the same box which is a Windows
> 2003 Enterprise server. Any help would be great.
Perhaps it has to do with the content type when the file is being sent
down. You may also want to set the content-disposition to indicate to
download the file, "Content-Disposition: Attachment" in the response header.
You aren't saying if you are trying to open up the file directly or save
it to disk first.
Aaron Weiker
http://aaronweiker.com/
http://www.sqlprogrammer.org/
|||Hi,
This is what i would do.
Try to download a PDF file from the file system (this rules out a problem
with IIS serving PDF-files).
Use WFetch[1] to request the PDF page (from the db), and see if IIS gives
a complete reply back (this will rule out a client-side problem).
Usually these kind of problems are caused by the programmers code. SQL
Server only stores the data, and IIS only "gives" the client the data.
Your code however do everything in between, and that is where it usually
goes wrong.
Regards,
Kristofer Gafvert
www.gafvert.info - My Articles and help
www.ilopia.com
fibreiv wrote:

> I have a SQL 2000 Standard server setup and I have a table in one of my
> databases to store files in. I am using asp code to retrieve the files
from
> the database. I can download txt, bmp files just fine but when it comes
to
> pdf documents it just hangs at the downloading the file screen and then
gives
> me a timeout error after awhile. It is not a problem with the file
sizes. I
> am testing it with a 20 and 60k pdf files and one of the txt files I
used to
> test with is a few mb. I am thinking it's either an IIS server config
issue
> or SQL Server config problem. The IIS server is for our intranet and is
not
> locked down. Both IIS and SQL are running on the same box which is a
Windows
> 2003 Enterprise server. Any help would be great.
> Thanks,
> Brett Bishop
> MCSE, MCP+I
> US Bankruptcy Court
|||I have the Content type set to application/pdf and I can't open it or save
it. Just to clarify the data is stored in SQL Image field.
"Aaron Weiker" wrote:

> fibreiv wrote:
> Perhaps it has to do with the content type when the file is being sent
> down. You may also want to set the content-disposition to indicate to
> download the file, "Content-Disposition: Attachment" in the response header.
> You aren't saying if you are trying to open up the file directly or save
> it to disk first.
> --
> Aaron Weiker
> http://aaronweiker.com/
> http://www.sqlprogrammer.org/
>
|||The file is stored in the Database in an Image field so there is no file
system access to the file.
"Tom Kaminski [MVP]" wrote:

> "fibreiv" <fibreiv@.discussions.microsoft.com> wrote in message
> news:0880684A-A141-4D78-842A-041C501DBCF5@.microsoft.com...
> from
> to
> gives
> I
> to
> issue
> not
> Windows
> Can you access PDF files via URL from the file system?
>
>
|||"fibreiv" <fibreiv@.discussions.microsoft.com> wrote in message
news:9BEC1745-770E-47BF-8749-06E8EBB48601@.microsoft.com...
> The file is stored in the Database in an Image field so there is no file
> system access to the file.
Understood.
As part of the troubleshooting routine, I'm asking if you can access one
from the file system.
|||I copied the same file thats in the database to the folder I have all the asp
files in on my server and put the url right to the pdf document and it opened
up acrobat and opened the file.
"Tom Kaminski [MVP]" wrote:

> "fibreiv" <fibreiv@.discussions.microsoft.com> wrote in message
> news:9BEC1745-770E-47BF-8749-06E8EBB48601@.microsoft.com...
> Understood.
> As part of the troubleshooting routine, I'm asking if you can access one
> from the file system.
>
>
|||fibreiv wrote:[vbcol=seagreen]
> I have the Content type set to application/pdf and I can't open it or save
> it. Just to clarify the data is stored in SQL Image field.
> "Aaron Weiker" wrote:
Are you setting "Content-Disposition" at all in the header?
Aaron Weiker
http://aaronweiker.com/
http://www.sqlprogrammer.org/
|||"fibreiv" <fibreiv@.discussions.microsoft.com> wrote in message
news:AED1E8B2-C2EE-4E02-9A38-BA527F0C6B2B@.microsoft.com...
> I copied the same file thats in the database to the folder I have all the
asp
> files in on my server and put the url right to the pdf document and it
opened
> up acrobat and opened the file.
OK - at this point, we'll need to see code to get an idea of how you're
doing it. In that case, I would suggest adding the ASP newsgroup as well
...
sql

Downloading File located in SQL Server with ASP

I have a SQL 2000 Standard server setup and I have a table in one of my
databases to store files in. I am using asp code to retrieve the files from
the database. I can download txt, bmp files just fine but when it comes to
pdf documents it just hangs at the downloading the file screen and then give
s
me a timeout error after awhile. It is not a problem with the file sizes.
I
am testing it with a 20 and 60k pdf files and one of the txt files I used to
test with is a few mb. I am thinking it's either an IIS server config issue
or SQL Server config problem. The IIS server is for our intranet and is not
locked down. Both IIS and SQL are running on the same box which is a Window
s
2003 Enterprise server. Any help would be great.
Thanks,
Brett Bishop
MCSE, MCP+I
US Bankruptcy Court"fibreiv" <fibreiv@.discussions.microsoft.com> wrote in message
news:0880684A-A141-4D78-842A-041C501DBCF5@.microsoft.com...
> I have a SQL 2000 Standard server setup and I have a table in one of my
> databases to store files in. I am using asp code to retrieve the files
from
> the database. I can download txt, bmp files just fine but when it comes
to
> pdf documents it just hangs at the downloading the file screen and then
gives
> me a timeout error after awhile. It is not a problem with the file sizes.
I
> am testing it with a 20 and 60k pdf files and one of the txt files I used
to
> test with is a few mb. I am thinking it's either an IIS server config
issue
> or SQL Server config problem. The IIS server is for our intranet and is
not
> locked down. Both IIS and SQL are running on the same box which is a
Windows
> 2003 Enterprise server. Any help would be great.
Can you access PDF files via URL from the file system?|||fibreiv wrote:
> I have a SQL 2000 Standard server setup and I have a table in one of my
> databases to store files in. I am using asp code to retrieve the files fr
om
> the database. I can download txt, bmp files just fine but when it comes t
o
> pdf documents it just hangs at the downloading the file screen and then gi
ves
> me a timeout error after awhile. It is not a problem with the file sizes.
I
> am testing it with a 20 and 60k pdf files and one of the txt files I used
to
> test with is a few mb. I am thinking it's either an IIS server config iss
ue
> or SQL Server config problem. The IIS server is for our intranet and is n
ot
> locked down. Both IIS and SQL are running on the same box which is a Wind
ows
> 2003 Enterprise server. Any help would be great.
Perhaps it has to do with the content type when the file is being sent
down. You may also want to set the content-disposition to indicate to
download the file, "Content-Disposition: Attachment" in the response header.
You aren't saying if you are trying to open up the file directly or save
it to disk first.
Aaron Weiker
http://aaronweiker.com/
http://www.sqlprogrammer.org/|||Hi,
This is what i would do.
Try to download a PDF file from the file system (this rules out a problem
with IIS serving PDF-files).
Use WFetch[1] to request the PDF page (from the db), and see if IIS gives
a complete reply back (this will rule out a client-side problem).
Usually these kind of problems are caused by the programmers code. SQL
Server only stores the data, and IIS only "gives" the client the data.
Your code however do everything in between, and that is where it usually
goes wrong.
Regards,
Kristofer Gafvert
www.gafvert.info - My Articles and help
www.ilopia.com
fibreiv wrote:

> I have a SQL 2000 Standard server setup and I have a table in one of my
> databases to store files in. I am using asp code to retrieve the files
from
> the database. I can download txt, bmp files just fine but when it comes
to
> pdf documents it just hangs at the downloading the file screen and then
gives
> me a timeout error after awhile. It is not a problem with the file
sizes. I
> am testing it with a 20 and 60k pdf files and one of the txt files I
used to
> test with is a few mb. I am thinking it's either an IIS server config
issue
> or SQL Server config problem. The IIS server is for our intranet and is
not
> locked down. Both IIS and SQL are running on the same box which is a
Windows
> 2003 Enterprise server. Any help would be great.
> Thanks,
> Brett Bishop
> MCSE, MCP+I
> US Bankruptcy Court|||I have the Content type set to application/pdf and I can't open it or save
it. Just to clarify the data is stored in SQL Image field.
"Aaron Weiker" wrote:

> fibreiv wrote:
> Perhaps it has to do with the content type when the file is being sent
> down. You may also want to set the content-disposition to indicate to
> download the file, "Content-Disposition: Attachment" in the response heade
r.
> You aren't saying if you are trying to open up the file directly or save
> it to disk first.
> --
> Aaron Weiker
> http://aaronweiker.com/
> http://www.sqlprogrammer.org/
>|||The file is stored in the Database in an Image field so there is no file
system access to the file.
"Tom Kaminski [MVP]" wrote:

> "fibreiv" <fibreiv@.discussions.microsoft.com> wrote in message
> news:0880684A-A141-4D78-842A-041C501DBCF5@.microsoft.com...
> from
> to
> gives
> I
> to
> issue
> not
> Windows
> Can you access PDF files via URL from the file system?
>
>|||"fibreiv" <fibreiv@.discussions.microsoft.com> wrote in message
news:9BEC1745-770E-47BF-8749-06E8EBB48601@.microsoft.com...
> The file is stored in the Database in an Image field so there is no file
> system access to the file.
Understood.
As part of the troubleshooting routine, I'm asking if you can access one
from the file system.|||I copied the same file thats in the database to the folder I have all the as
p
files in on my server and put the url right to the pdf document and it opene
d
up acrobat and opened the file.
"Tom Kaminski [MVP]" wrote:

> "fibreiv" <fibreiv@.discussions.microsoft.com> wrote in message
> news:9BEC1745-770E-47BF-8749-06E8EBB48601@.microsoft.com...
> Understood.
> As part of the troubleshooting routine, I'm asking if you can access one
> from the file system.
>
>|||fibreiv wrote:
> I have the Content type set to application/pdf and I can't open it or save
> it. Just to clarify the data is stored in SQL Image field.
> "Aaron Weiker" wrote:
Are you setting "Content-Disposition" at all in the header?
Aaron Weiker
http://aaronweiker.com/
http://www.sqlprogrammer.org/|||"fibreiv" <fibreiv@.discussions.microsoft.com> wrote in message
news:AED1E8B2-C2EE-4E02-9A38-BA527F0C6B2B@.microsoft.com...
> I copied the same file thats in the database to the folder I have all the
asp
> files in on my server and put the url right to the pdf document and it
opened
> up acrobat and opened the file.
OK - at this point, we'll need to see code to get an idea of how you're
doing it. In that case, I would suggest adding the ASP newsgroup as well
...

Downloading File located in SQL Server with ASP

I have a SQL 2000 Standard server setup and I have a table in one of my
databases to store files in. I am using asp code to retrieve the files from
the database. I can download txt, bmp files just fine but when it comes to
pdf documents it just hangs at the downloading the file screen and then give
s
me a timeout error after awhile. It is not a problem with the file sizes.
I
am testing it with a 20 and 60k pdf files and one of the txt files I used to
test with is a few mb. I am thinking it's either an IIS server config issue
or SQL Server config problem. The IIS server is for our intranet and is not
locked down. Both IIS and SQL are running on the same box which is a Window
s
2003 Enterprise server. Any help would be great.
Thanks,
Brett Bishop
MCSE, MCP+I
US Bankruptcy Court"fibreiv" <fibreiv@.discussions.microsoft.com> wrote in message
news:0880684A-A141-4D78-842A-041C501DBCF5@.microsoft.com...
> I have a SQL 2000 Standard server setup and I have a table in one of my
> databases to store files in. I am using asp code to retrieve the files
from
> the database. I can download txt, bmp files just fine but when it comes
to
> pdf documents it just hangs at the downloading the file screen and then
gives
> me a timeout error after awhile. It is not a problem with the file sizes.
I
> am testing it with a 20 and 60k pdf files and one of the txt files I used
to
> test with is a few mb. I am thinking it's either an IIS server config
issue
> or SQL Server config problem. The IIS server is for our intranet and is
not
> locked down. Both IIS and SQL are running on the same box which is a
Windows
> 2003 Enterprise server. Any help would be great.
Can you access PDF files via URL from the file system?|||fibreiv wrote:
> I have a SQL 2000 Standard server setup and I have a table in one of my
> databases to store files in. I am using asp code to retrieve the files fr
om
> the database. I can download txt, bmp files just fine but when it comes t
o
> pdf documents it just hangs at the downloading the file screen and then gi
ves
> me a timeout error after awhile. It is not a problem with the file sizes.
I
> am testing it with a 20 and 60k pdf files and one of the txt files I used
to
> test with is a few mb. I am thinking it's either an IIS server config iss
ue
> or SQL Server config problem. The IIS server is for our intranet and is n
ot
> locked down. Both IIS and SQL are running on the same box which is a Wind
ows
> 2003 Enterprise server. Any help would be great.
Perhaps it has to do with the content type when the file is being sent
down. You may also want to set the content-disposition to indicate to
download the file, "Content-Disposition: Attachment" in the response header.
You aren't saying if you are trying to open up the file directly or save
it to disk first.
Aaron Weiker
http://aaronweiker.com/
http://www.sqlprogrammer.org/|||Hi,
This is what i would do.
Try to download a PDF file from the file system (this rules out a problem
with IIS serving PDF-files).
Use WFetch[1] to request the PDF page (from the db), and see if IIS give
s
a complete reply back (this will rule out a client-side problem).
Usually these kind of problems are caused by the programmers code. SQL
Server only stores the data, and IIS only "gives" the client the data.
Your code however do everything in between, and that is where it usually
goes wrong.
Regards,
Kristofer Gafvert
www.gafvert.info - My Articles and help
www.ilopia.com
fibreiv wrote:

> I have a SQL 2000 Standard server setup and I have a table in one of my
> databases to store files in. I am using asp code to retrieve the files
from
> the database. I can download txt, bmp files just fine but when it comes
to
> pdf documents it just hangs at the downloading the file screen and then
gives
> me a timeout error after awhile. It is not a problem with the file
sizes. I
> am testing it with a 20 and 60k pdf files and one of the txt files I
used to
> test with is a few mb. I am thinking it's either an IIS server config
issue
> or SQL Server config problem. The IIS server is for our intranet and is
not
> locked down. Both IIS and SQL are running on the same box which is a
Windows
> 2003 Enterprise server. Any help would be great.
> Thanks,
> Brett Bishop
> MCSE, MCP+I
> US Bankruptcy Court|||I have the Content type set to application/pdf and I can't open it or save
it. Just to clarify the data is stored in SQL Image field.
"Aaron Weiker" wrote:

> fibreiv wrote:
> Perhaps it has to do with the content type when the file is being sent
> down. You may also want to set the content-disposition to indicate to
> download the file, "Content-Disposition: Attachment" in the response heade
r.
> You aren't saying if you are trying to open up the file directly or save
> it to disk first.
> --
> Aaron Weiker
> http://aaronweiker.com/
> http://www.sqlprogrammer.org/
>|||The file is stored in the Database in an Image field so there is no file
system access to the file.
"Tom Kaminski [MVP]" wrote:

> "fibreiv" <fibreiv@.discussions.microsoft.com> wrote in message
> news:0880684A-A141-4D78-842A-041C501DBCF5@.microsoft.com...
> from
> to
> gives
> I
> to
> issue
> not
> Windows
> Can you access PDF files via URL from the file system?
>
>|||"fibreiv" <fibreiv@.discussions.microsoft.com> wrote in message
news:9BEC1745-770E-47BF-8749-06E8EBB48601@.microsoft.com...
> The file is stored in the Database in an Image field so there is no file
> system access to the file.
Understood.
As part of the troubleshooting routine, I'm asking if you can access one
from the file system.|||I copied the same file thats in the database to the folder I have all the as
p
files in on my server and put the url right to the pdf document and it opene
d
up acrobat and opened the file.
"Tom Kaminski [MVP]" wrote:

> "fibreiv" <fibreiv@.discussions.microsoft.com> wrote in message
> news:9BEC1745-770E-47BF-8749-06E8EBB48601@.microsoft.com...
> Understood.
> As part of the troubleshooting routine, I'm asking if you can access one
> from the file system.
>
>|||fibreiv wrote:[vbcol=seagreen]
> I have the Content type set to application/pdf and I can't open it or save
> it. Just to clarify the data is stored in SQL Image field.
> "Aaron Weiker" wrote:
Are you setting "Content-Disposition" at all in the header?
Aaron Weiker
http://aaronweiker.com/
http://www.sqlprogrammer.org/|||"fibreiv" <fibreiv@.discussions.microsoft.com> wrote in message
news:AED1E8B2-C2EE-4E02-9A38-BA527F0C6B2B@.microsoft.com...
> I copied the same file thats in the database to the folder I have all the
asp
> files in on my server and put the url right to the pdf document and it
opened
> up acrobat and opened the file.
OK - at this point, we'll need to see code to get an idea of how you're
doing it. In that case, I would suggest adding the ASP newsgroup as well
...

Downloading File located in SQL Server with ASP

I have a SQL 2000 Standard server setup and I have a table in one of my
databases to store files in. I am using asp code to retrieve the files from
the database. I can download txt, bmp files just fine but when it comes to
pdf documents it just hangs at the downloading the file screen and then gives
me a timeout error after awhile. It is not a problem with the file sizes. I
am testing it with a 20 and 60k pdf files and one of the txt files I used to
test with is a few mb. I am thinking it's either an IIS server config issue
or SQL Server config problem. The IIS server is for our intranet and is not
locked down. Both IIS and SQL are running on the same box which is a Windows
2003 Enterprise server. Any help would be great.
Thanks,
Brett Bishop
MCSE, MCP+I
US Bankruptcy Court"fibreiv" <fibreiv@.discussions.microsoft.com> wrote in message
news:0880684A-A141-4D78-842A-041C501DBCF5@.microsoft.com...
> I have a SQL 2000 Standard server setup and I have a table in one of my
> databases to store files in. I am using asp code to retrieve the files
from
> the database. I can download txt, bmp files just fine but when it comes
to
> pdf documents it just hangs at the downloading the file screen and then
gives
> me a timeout error after awhile. It is not a problem with the file sizes.
I
> am testing it with a 20 and 60k pdf files and one of the txt files I used
to
> test with is a few mb. I am thinking it's either an IIS server config
issue
> or SQL Server config problem. The IIS server is for our intranet and is
not
> locked down. Both IIS and SQL are running on the same box which is a
Windows
> 2003 Enterprise server. Any help would be great.
Can you access PDF files via URL from the file system?|||fibreiv wrote:
> I have a SQL 2000 Standard server setup and I have a table in one of my
> databases to store files in. I am using asp code to retrieve the files from
> the database. I can download txt, bmp files just fine but when it comes to
> pdf documents it just hangs at the downloading the file screen and then gives
> me a timeout error after awhile. It is not a problem with the file sizes. I
> am testing it with a 20 and 60k pdf files and one of the txt files I used to
> test with is a few mb. I am thinking it's either an IIS server config issue
> or SQL Server config problem. The IIS server is for our intranet and is not
> locked down. Both IIS and SQL are running on the same box which is a Windows
> 2003 Enterprise server. Any help would be great.
Perhaps it has to do with the content type when the file is being sent
down. You may also want to set the content-disposition to indicate to
download the file, "Content-Disposition: Attachment" in the response header.
You aren't saying if you are trying to open up the file directly or save
it to disk first.
--
Aaron Weiker
http://aaronweiker.com/
http://www.sqlprogrammer.org/|||Hi,
This is what i would do.
Try to download a PDF file from the file system (this rules out a problem
with IIS serving PDF-files).
Use WFetch[1] to request the PDF page (from the db), and see if IIS gives
a complete reply back (this will rule out a client-side problem).
Usually these kind of problems are caused by the programmers code. SQL
Server only stores the data, and IIS only "gives" the client the data.
Your code however do everything in between, and that is where it usually
goes wrong.
--
Regards,
Kristofer Gafvert
www.gafvert.info - My Articles and help
www.ilopia.com
fibreiv wrote:
> I have a SQL 2000 Standard server setup and I have a table in one of my
> databases to store files in. I am using asp code to retrieve the files
from
> the database. I can download txt, bmp files just fine but when it comes
to
> pdf documents it just hangs at the downloading the file screen and then
gives
> me a timeout error after awhile. It is not a problem with the file
sizes. I
> am testing it with a 20 and 60k pdf files and one of the txt files I
used to
> test with is a few mb. I am thinking it's either an IIS server config
issue
> or SQL Server config problem. The IIS server is for our intranet and is
not
> locked down. Both IIS and SQL are running on the same box which is a
Windows
> 2003 Enterprise server. Any help would be great.
> Thanks,
> Brett Bishop
> MCSE, MCP+I
> US Bankruptcy Court|||I have the Content type set to application/pdf and I can't open it or save
it. Just to clarify the data is stored in SQL Image field.
"Aaron Weiker" wrote:
> fibreiv wrote:
> > I have a SQL 2000 Standard server setup and I have a table in one of my
> > databases to store files in. I am using asp code to retrieve the files from
> > the database. I can download txt, bmp files just fine but when it comes to
> > pdf documents it just hangs at the downloading the file screen and then gives
> > me a timeout error after awhile. It is not a problem with the file sizes. I
> > am testing it with a 20 and 60k pdf files and one of the txt files I used to
> > test with is a few mb. I am thinking it's either an IIS server config issue
> > or SQL Server config problem. The IIS server is for our intranet and is not
> > locked down. Both IIS and SQL are running on the same box which is a Windows
> > 2003 Enterprise server. Any help would be great.
> Perhaps it has to do with the content type when the file is being sent
> down. You may also want to set the content-disposition to indicate to
> download the file, "Content-Disposition: Attachment" in the response header.
> You aren't saying if you are trying to open up the file directly or save
> it to disk first.
> --
> Aaron Weiker
> http://aaronweiker.com/
> http://www.sqlprogrammer.org/
>|||The file is stored in the Database in an Image field so there is no file
system access to the file.
"Tom Kaminski [MVP]" wrote:
> "fibreiv" <fibreiv@.discussions.microsoft.com> wrote in message
> news:0880684A-A141-4D78-842A-041C501DBCF5@.microsoft.com...
> > I have a SQL 2000 Standard server setup and I have a table in one of my
> > databases to store files in. I am using asp code to retrieve the files
> from
> > the database. I can download txt, bmp files just fine but when it comes
> to
> > pdf documents it just hangs at the downloading the file screen and then
> gives
> > me a timeout error after awhile. It is not a problem with the file sizes.
> I
> > am testing it with a 20 and 60k pdf files and one of the txt files I used
> to
> > test with is a few mb. I am thinking it's either an IIS server config
> issue
> > or SQL Server config problem. The IIS server is for our intranet and is
> not
> > locked down. Both IIS and SQL are running on the same box which is a
> Windows
> > 2003 Enterprise server. Any help would be great.
> Can you access PDF files via URL from the file system?
>
>|||"fibreiv" <fibreiv@.discussions.microsoft.com> wrote in message
news:9BEC1745-770E-47BF-8749-06E8EBB48601@.microsoft.com...
> The file is stored in the Database in an Image field so there is no file
> system access to the file.
Understood.
As part of the troubleshooting routine, I'm asking if you can access one
from the file system.|||I copied the same file thats in the database to the folder I have all the asp
files in on my server and put the url right to the pdf document and it opened
up acrobat and opened the file.
"Tom Kaminski [MVP]" wrote:
> "fibreiv" <fibreiv@.discussions.microsoft.com> wrote in message
> news:9BEC1745-770E-47BF-8749-06E8EBB48601@.microsoft.com...
> > The file is stored in the Database in an Image field so there is no file
> > system access to the file.
> Understood.
> As part of the troubleshooting routine, I'm asking if you can access one
> from the file system.
>
>|||fibreiv wrote:
> I have the Content type set to application/pdf and I can't open it or save
> it. Just to clarify the data is stored in SQL Image field.
> "Aaron Weiker" wrote:
>>Perhaps it has to do with the content type when the file is being sent
>>down. You may also want to set the content-disposition to indicate to
>>download the file, "Content-Disposition: Attachment" in the response header.
Are you setting "Content-Disposition" at all in the header?
--
Aaron Weiker
http://aaronweiker.com/
http://www.sqlprogrammer.org/|||"fibreiv" <fibreiv@.discussions.microsoft.com> wrote in message
news:AED1E8B2-C2EE-4E02-9A38-BA527F0C6B2B@.microsoft.com...
> I copied the same file thats in the database to the folder I have all the
asp
> files in on my server and put the url right to the pdf document and it
opened
> up acrobat and opened the file.
OK - at this point, we'll need to see code to get an idea of how you're
doing it. In that case, I would suggest adding the ASP newsgroup as well
...|||Here is what I am doing to test it. I have hardcoded the file I want to get
out of the database.
Connect = "Provider=SQLOLEDB.1;Persist Security Info=False;User
ID=sa;Password=;Initial Catalog=INNB;Data Source=pompom"
Set db = Server.CreateObject("ADODB.Connection")
db.Open Connect
SQL = "SELECT filesize, contenttype, filename, filedata FROM thefiles where
id = 2"
Set rs = db.Execute( SQL )
If rs.EOF Then Response.End
Response.ContentType = "application/pdf"
Response.AddHeader "Content-Disposition", "attachment;filename=agencies.pdf"
Response.AddHeader "Content-Length", "16863"
Response.BinaryWrite rs("filedata")
"Aaron Weiker" wrote:
> fibreiv wrote:
> > I have the Content type set to application/pdf and I can't open it or save
> > it. Just to clarify the data is stored in SQL Image field.
> >
> > "Aaron Weiker" wrote:
> >>Perhaps it has to do with the content type when the file is being sent
> >>down. You may also want to set the content-disposition to indicate to
> >>download the file, "Content-Disposition: Attachment" in the response header.
> Are you setting "Content-Disposition" at all in the header?
> --
> Aaron Weiker
> http://aaronweiker.com/
> http://www.sqlprogrammer.org/
>|||fibreiv wrote:
> Connect = "Provider=SQLOLEDB.1;Persist Security Info=False;User
> ID=sa;Password=;Initial Catalog=INNB;Data Source=pompom"
> Set db = Server.CreateObject("ADODB.Connection")
> db.Open Connect
> SQL = "SELECT filesize, contenttype, filename, filedata FROM thefiles where
> id = 2"
> Set rs = db.Execute( SQL )
> If rs.EOF Then Response.End
> Response.ContentType = "application/pdf"
> Response.AddHeader "Content-Disposition", "attachment;filename=agencies.pdf"
> Response.AddHeader "Content-Length", "16863"
> Response.BinaryWrite rs("filedata")
Have you tried putting Response.End at the end? Someone else may be able
to help identify a missing piece as it's been a long time since I did this.
--
Aaron Weiker
http://aaronweiker.com/
http://www.sqlprogrammer.org/

downloading database to local mdf file, sql dumb on SMSE

Hi,

I'm trying to work on a database when I'm not connected. I can't figure out how to get a local copy of a database.mdf that I created on the server, onto my hard drive, using SQL Management Studio Express. Does anyone have any suggestions? I'd be forever in your debt. Thanks

Hi,

You can backup/restore database or your detach/attach database.

Use sp_detach_db procedure and sp_attach_db procedure to achieve this.

For more information, check

http://msdn2.microsoft.com/en-us/library/ms188031.aspx
http://msdn2.microsoft.com/en-us/library/aa259611(SQL.80).aspx

HTH. If this does not answer your question, please feel free to mark the post as Not Answered and reply. Thank you!

Sunday, March 25, 2012

Downloading data into a txt file

Dear All,

I have an application running on my mobile device and the data is stored in the mobile database. So now i am trying to build any application on my pc which upon click should download the data from my mobile database into a local text file. Is there any idea or reference where I can stary working on this ?

DataSet ds = new DataSet();

...

DataAdapter da = new DataAdapter(...);

da.Fill(ds, "table1");

...

da.Fill(ds, "tableN");

ds.WriteXml("LocalTextFile.xml");

If XML is not what you want then write data row by row in the format you want using System.IO namespace.

|||

Dear Ilya,

I would prefer it to be in text file format. The problem what project shall I develop I mean in the visual studio 2005. Should it be windows form or device application ? Because if it is device application it cant run in my desktop rite ? So it should be windows form rite ? Thanks.

|||

Dear Ilya,

I have now build a new console application. So then I add a reference to

System.Data.SqlServerCe; to enable me to connect to the mobile database found in the pda. So when I try to run I get an error "Could not load file or assembly 'System.Data.SqlServerCe, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)". The problem is that on the same machine I can compile my device application which is also using the same reference'System.Data.SqlServerCe. Please correct me if I am doing something wrong here. Another thing is that how must I reference the path to my mobile database in the pda ? I am trying like this I dont know if this is right

Mobile Device/MiniSD Card/MiniSD Card/test1/db1.sdf. Thanks.

|||

Dear All,

I have a problem here. What i exactly want to do it that build a console application where when I connect my pda to my desktop and run the exe file it should be able to transfer the .sdf data into a text file of my local desktop ? Is there any code or reference where can guide me ?

|||Some of the components from www.primeworks-mobile.com should be able to help you.|||

Dear ErikEJ,

I would prefer to write on my own as I cant afford third party software. Hope you can show me some light into it. Thanks.

|||What you are going to want to probably do is copy the database from the device to your desktop, then use the sql ce for the desktop libs (remember you can use sql ce on devices and full blown windows) to read through the database and output . You can accomplish copying the database over through code using the Windows CE RAPI. The full framework as far as I know does not have built-in support for it. So what you would need to do is P/Invoke some functions in the rapi.dll. Luckily somebody has essentially done this, look for the opennetcf's (www.opennetcf.org) desktop communication library. So once you use this to get a copy of the database over to your desktop you can use the sql ce for windows (not wm or ce) libs to connect to your now local copy of the database. Then using a SqlCeDataReader you can just iterate through every record in the database, while reading a record in you can format it however you like then push that into a file using a StreamWriter object.
|||

Dear Steve,

Thank you very much for your kind information. So now I have downloaded the OpenNETCF.Desktop.Communication Library . Now how shall I start ? Shall I start by building a console application ? So must I first manually download the database or the system can do it for me ? I am really at lost can your pls guide me further on this. Thanks once again.

|||If you want to do it as a console application then start there. Then my next step would be to use the Desktop Communication library to programmatically get the database from your device to local computer. The communication library should have came with an example application that you can probably look at to find out how they copy files back and forth. You can look their and do the same thing.
|||

Dear Steve,

Ok I have followed and done accordingly and sucessfully download the sdf file into my desktop. My next problem is that i am not able to connect to downloaded .sdf in the desktop. I am using the same code as I build the windows device application. Can your please tell me wat can be my mistake ? For example I use this

SqlCeConnection conn1 = new SqlCeConnection("Data Source = c:/test1.sdf");

First I got an error "Could not load file or assembly 'System.Data.SqlServerCe, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)". Then I manage to solve "Unable to load DLL 'sqlceme30.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)". So wat is the possible error on my side ?

So what can be possible error on my side ? Thanks.

|||

Dear Steve,

I am ok with Desktop Communication library. I have already managed to download the database from the device to my local computer. My next step is that how can I from my console application link to the database which I have already downloaded using the said library. Thanks once again.

|||Once you have the sdf file over to you desktop you can use the desktop version of the sqlce data object. I think you need to download the Microsoft SQL Server Mobile 2005 Mobile Edition SDK. Once you have that downloaded and installed it you should be able to add the proper references to the desktop x86 version of the libraries that you need. Then you should be able to connect to the database and use it just like you did on the handheld with the .NET CF. You should be able to just use a SqlCeDataReader object to query the database then read through the returned records and output them using a StreamWriter object to put them into a text file which you can then control the format of.
|||

Dear Steve,

I have already downloaded the microsoft sql server mobile 2005 mobile edition sdk. So I tried to use the SqlCeDataReader and below is the errors I got. Can you please guide me on this ?

SqlCeConnection conn1 = new SqlCeConnection("Data Source = c:/test1.sdf");

First I got an error "Could not load file or assembly 'System.Data.SqlServerCe, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)". Then I manage to solve that problem but got another one "Unable to load DLL 'sqlceme30.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)". So wat is the possible error on my side ?Thanks.

Downloading data into a txt file

Dear All,

I have an application running on my mobile device and the data is stored in the mobile database. So now i am trying to build any application on my pc which upon click should download the data from my mobile database into a local text file. Is there any idea or reference where I can stary working on this ?

DataSet ds = new DataSet();

...

DataAdapter da = new DataAdapter(...);

da.Fill(ds, "table1");

...

da.Fill(ds, "tableN");

ds.WriteXml("LocalTextFile.xml");

If XML is not what you want then write data row by row in the format you want using System.IO namespace.

|||

Dear Ilya,

I would prefer it to be in text file format. The problem what project shall I develop I mean in the visual studio 2005. Should it be windows form or device application ? Because if it is device application it cant run in my desktop rite ? So it should be windows form rite ? Thanks.

|||

Dear Ilya,

I have now build a new console application. So then I add a reference to

System.Data.SqlServerCe; to enable me to connect to the mobile database found in the pda. So when I try to run I get an error "Could not load file or assembly 'System.Data.SqlServerCe, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)". The problem is that on the same machine I can compile my device application which is also using the same reference'System.Data.SqlServerCe. Please correct me if I am doing something wrong here. Another thing is that how must I reference the path to my mobile database in the pda ? I am trying like this I dont know if this is right

Mobile Device/MiniSD Card/MiniSD Card/test1/db1.sdf. Thanks.

|||

Dear All,

I have a problem here. What i exactly want to do it that build a console application where when I connect my pda to my desktop and run the exe file it should be able to transfer the .sdf data into a text file of my local desktop ? Is there any code or reference where can guide me ?

|||Some of the components from www.primeworks-mobile.com should be able to help you.|||

Dear ErikEJ,

I would prefer to write on my own as I cant afford third party software. Hope you can show me some light into it. Thanks.

|||What you are going to want to probably do is copy the database from the device to your desktop, then use the sql ce for the desktop libs (remember you can use sql ce on devices and full blown windows) to read through the database and output . You can accomplish copying the database over through code using the Windows CE RAPI. The full framework as far as I know does not have built-in support for it. So what you would need to do is P/Invoke some functions in the rapi.dll. Luckily somebody has essentially done this, look for the opennetcf's (www.opennetcf.org) desktop communication library. So once you use this to get a copy of the database over to your desktop you can use the sql ce for windows (not wm or ce) libs to connect to your now local copy of the database. Then using a SqlCeDataReader you can just iterate through every record in the database, while reading a record in you can format it however you like then push that into a file using a StreamWriter object.
|||

Dear Steve,

Thank you very much for your kind information. So now I have downloaded the OpenNETCF.Desktop.Communication Library . Now how shall I start ? Shall I start by building a console application ? So must I first manually download the database or the system can do it for me ? I am really at lost can your pls guide me further on this. Thanks once again.

|||If you want to do it as a console application then start there. Then my next step would be to use the Desktop Communication library to programmatically get the database from your device to local computer. The communication library should have came with an example application that you can probably look at to find out how they copy files back and forth. You can look their and do the same thing.
|||

Dear Steve,

Ok I have followed and done accordingly and sucessfully download the sdf file into my desktop. My next problem is that i am not able to connect to downloaded .sdf in the desktop. I am using the same code as I build the windows device application. Can your please tell me wat can be my mistake ? For example I use this

SqlCeConnection conn1 = new SqlCeConnection("Data Source = c:/test1.sdf");

First I got an error "Could not load file or assembly 'System.Data.SqlServerCe, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)". Then I manage to solve "Unable to load DLL 'sqlceme30.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)". So wat is the possible error on my side ?

So what can be possible error on my side ? Thanks.

|||

Dear Steve,

I am ok with Desktop Communication library. I have already managed to download the database from the device to my local computer. My next step is that how can I from my console application link to the database which I have already downloaded using the said library. Thanks once again.

|||Once you have the sdf file over to you desktop you can use the desktop version of the sqlce data object. I think you need to download the Microsoft SQL Server Mobile 2005 Mobile Edition SDK. Once you have that downloaded and installed it you should be able to add the proper references to the desktop x86 version of the libraries that you need. Then you should be able to connect to the database and use it just like you did on the handheld with the .NET CF. You should be able to just use a SqlCeDataReader object to query the database then read through the returned records and output them using a StreamWriter object to put them into a text file which you can then control the format of.
|||

Dear Steve,

I have already downloaded the microsoft sql server mobile 2005 mobile edition sdk. So I tried to use the SqlCeDataReader and below is the errors I got. Can you please guide me on this ?

SqlCeConnection conn1 = new SqlCeConnection("Data Source = c:/test1.sdf");

First I got an error "Could not load file or assembly 'System.Data.SqlServerCe, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)". Then I manage to solve that problem but got another one "Unable to load DLL 'sqlceme30.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)". So wat is the possible error on my side ?Thanks.

downloading data from a table

I need to download all data in a table into a text file or an excel spreadsheet. What would be the easiest way to do this?
Hi,
Please see the reply to the same post in microsoft.public.sqlserver.server
group
Thanks
Hari
"Joel" <anonymous@.discussions.microsoft.com> wrote in message
news:4E7B6116-7F34-47B0-B8C7-055E2DCF1560@.microsoft.com...
> I need to download all data in a table into a text file or an excel
spreadsheet. What would be the easiest way to do this?
>

Download the SQL servere date to excel file using ASP.net

Hi EveryOne

I would like to download the SQL server databse to excel file using ASP.Net

I need to download the one table to excel file. If anyone knows please help me.

With Regards

Nibu Abraham

hi

i found this link

http://www.theserverside.net/discussions/thread.tss?thread_id=29385

give a try

|||

Hi Nibu

Create a stored procedure to display the required columns from the give table. Grant execute permission to this stored procedure to the role that your ASP.NET account is assigned to. In your datalayer, run the stored procedure to output a dataset. Add a gridview control (or datagrid if still at ASP.NET 1.1) to an ASPX form.

Set the datasource for the control to the dataset produced by the read function in your data layer, call databind and the data will be displayed.

There is a simple modifier to make the displayed page OLE load Excel - I will find out the how of this at the weekend.

HTH

|||

You need to add the following to your Page_Load

Response.ContentType = "application/vnd.ms-excel";

Response.Charset = "";

You will need to turn off the sort option on the grid and any other hyperlinks on the form.

HTH

sql

Download the file stored in sqlserver table as image datatype using asp.net 2.0

I am using Asp.net 2.0 with C# and sql server 2000. I need to download the file which is stored in sql server database table as image datatype. So I need to download from cs page.

Pls reply,

Arun.

Here's a good article on storing and retrieving binary data with asp.net 2.0
http://www.beansoftware.com/ASP.NET-Tutorials/Binary-Files-To-Database.aspx

|||

Hi,

Consider, you have query like

select files,filename,filesize,fileext from filesintable where id=1

that file on dar[0] as image datatype.

while (dar.Read())
{
bFile = (byte[])dar[0];
Response.AddHeader("Content-Disposition", "attachment; filename=" +dar[1].ToString());

switch (dar[3].ToString())
{
case "ask":
Response.ContentType = "video/x-ms-asf";
break;
case "avi":
Response.ContentType = "video/avi";
break;
case "doc":
Response.ContentType = "application/msword";
break;
case "zip":
Response.ContentType = "application/zip";
break;
case "xls":
Response.ContentType = "application/vnd.ms-excel";
break;
case "ppt":
Response.ContentType = "application/vnd.ms-powerpoint";
break;
case "gif":
Response.ContentType = "image/gif";
break;
case "jpg":
case "jpeg":
Response.ContentType = "image/jpeg";
break;
case "wav":
Response.ContentType = "audio/wav";
break;
case "mp3":
Response.ContentType = "audio/mpeg3";
break;
case "mpg":
case "mpeg":
Response.ContentType = "video/mpeg";
break;
case "rtf":
Response.ContentType = "application/rtf";
break;
case "htm":
case "html":
Response.ContentType = "text/html";
break;
case "asp":
Response.ContentType = "text/asp";
break;
case "pdf":
Response.ContentType = "application/pdf";
break;
default:
Response.ContentType = "application/octet-stream";
break;
}
Response.BinaryWrite(bFile);

}

It works fine.

Download Snapshot file by FTP

HI,
I try to use the FTP protocol to transfert the snapshot file from the
Distributers to the subcribers
What I did is that I right click on the subcription on the subcribers Laptop
I choose the tab Snapshot File location
Instead of using Get the snapshot file from the Publisher normal snapshot
folder I try to use the option Download the snapshot using FTP
It does work but what FTP services Sql Use because i did not set up any Ftp
server
I dont understand
Also it is more stable to use Ftp protocol instead of Sharing Folder
Thanks in advance
You normally use FTP when you are replicating over the internet. Let me ask
some basic questions first. Did you configure your publication for FTP? Have
you reviewed the ftp logs for errors?
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"GC" <GC@.discussions.microsoft.com> wrote in message
news:151761DE-14F0-4DE2-963B-DD9EF9EBC31B@.microsoft.com...
> HI,
> I try to use the FTP protocol to transfert the snapshot file from the
> Distributers to the subcribers
> What I did is that I right click on the subcription on the subcribers
> Laptop
> I choose the tab Snapshot File location
> Instead of using Get the snapshot file from the Publisher normal snapshot
> folder I try to use the option Download the snapshot using FTP
> It does work but what FTP services Sql Use because i did not set up any
> Ftp
> server
> I dont understand
> Also it is more stable to use Ftp protocol instead of Sharing Folder
> Thanks in advance
>
|||No , i did not configure the publication for FTP.
If we use FTP when we are replcating over Internet, I wont use it because we
are using Shared Folder over the Intranet network
Thank you for the information
"Hilary Cotter" wrote:

> You normally use FTP when you are replicating over the internet. Let me ask
> some basic questions first. Did you configure your publication for FTP? Have
> you reviewed the ftp logs for errors?
> --
> Hilary Cotter
> Looking for a SQL Server replication book?
> http://www.nwsu.com/0974973602.html
> Looking for a FAQ on Indexing Services/SQL FTS
> http://www.indexserverfaq.com
> "GC" <GC@.discussions.microsoft.com> wrote in message
> news:151761DE-14F0-4DE2-963B-DD9EF9EBC31B@.microsoft.com...
>
>

Download Problem

Hi,
I had download a file with .DTS extension from SQLDTS.Com
how can i use it .
Pls help
from
DollerSorry to post the question.
I did it
from
dollersql

Download Problem

Hi,
I had download a file with .DTS extension from SQLDTS.Com
how can i use it .
Pls help
from
Doller
Sorry to post the question.
I did it
from
doller

Download Problem

Hi,
I had download a file with .DTS extension from SQLDTS.Com
how can i use it .
Pls help
from
DollerSorry to post the question.
I did it
from
doller

Download Microsoft OLE DB Provider for DB2

Hi

The readme file for SQL Server 2005 says:

4.10.1 Obtaining the Microsoft OLE DB Provider for DB2

The Microsoft OLE DB Provider for DB2, which is a component of Microsoft Host Integration Server 2004, can be downloaded for use with SQL Server 2005. For information about how to install and configure the OLE DB provider, see the documentation that is included with the provider. For instructions about how to download this provider, see this Microsoft Web site. (http://go.microsoft.com/fwlink/?LinkId=52036)

However, I cannot seem to find it...?! Sad

Michael, try check back after 11/7 (the day for SQLServer2005 Launch).

Thanks
Wenyangsql

Thursday, March 22, 2012

Download file that is stored in Sql Server database

Hi,
I have tried to implement file download option. I can download file which is stored in any folder. Code is...

string filepath = Request.Params["file"].ToString();
string filename = Path.GetFileName(filepath);
Response.Clear();
Response.ContentType = "image/gif";
Response.AddHeader("Content-Disposition", "attachment; filename=" + filename);
Response.Flush();
Response.WriteFile(filepath);

This code is working fine. But now I am facing a problem. Files (not the path) are stored in database table. User can download file from the database. How can I do this? The file may be a .txt, .doc, .xls, .jpg or .gif.

Hi,|||

Hi,

first: get the data from DB

second: use the following code:

byte[] data = TheMethodToReadTheFieldFromDB();using (Stream st =new MemoryStream(data)){long dataLengthToRead = st.Length;Response.ContentType ="text/plain";//Or other you needResponse.AddHeader("Content-Disposition","attachment; filename=\"" + theFileName + "\"");while (dataLengthToRead > 0 && Response.IsClientConnected){Int32 lengthRead = st.Read(buffer, 0, blockSize);Response.OutputStream.Write(buffer, 0, lengthRead);Response.Flush();dataLengthToRead = dataLengthToRead - lengthRead;}Response.Flush();Response.Close();}Response.End();
|||

Thank your for your reply. It is working. I want to know one more thing. Can I zip a file before download? How?

Angshujit

|||

Hi,

If you wish to zip the file, you will need to load additional library to compress the file. You can search on the web to see if there is a library for your to use. Writing the compress algorithm will take you much efforts.

|||

Hi,

Thank you for your reply. I have found a library - ZipLib. Now it is working fine. But one problem is that every time in the time of download, it creates a zip file in the root folder. How can I delete this file?

Angshujit

|||

Hi angshujit,

You can use System.IO.File.Delete() method to delete the file. You need to make sure that the file has been downloaded to the client. Then you can delete the source file.

HTH. If this does not answer you question, please feel free to mark it as Not Answered and post your reply. Thanks!

|||

Hi Kevin,

Well, my "dilema" is similar. Basically instead of showing the content on the same page that made the request (let′s say on page 'A', where page 'A' has a button that says "select") I need to show my content on a new page. So far I have this:

void gv_SelectedIndexChanging(object sender, GridViewSelectEventArgs e) { String strResult ="", strExtension =""; String strDirectory, strFileName; GridView view = (GridView)sender; Guid __ID =new Guid(view.Rows[e.NewSelectedIndex].Cells[1].Text); Content c =new Content(Connection, __ID);// Byte[] btArray = c.GetFile(ref strResult,out strExtension);if (btArray !=null) { strDirectory ="ContentFiles"; strFileName = Page.Request.PhysicalApplicationPath; strFileName = strFileName + strDirectory;if (!System.IO.Directory.Exists(strFileName)) System.IO.Directory.CreateDirectory(strFileName); strFileName +="\\" +"content" + c.HumanNumber + strExtension;// System.IO.FileStream fs;if (!System.IO.File.Exists(strFileName)) fs = System.IO.File.Create(strFileName);else fs =new System.IO.FileStream(strFileName, System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.Write);// System.IO.BinaryWriter writer =new System.IO.BinaryWriter(fs); writer.Write(btArray); writer.Flush(); writer.Close(); fs.Close(); Page.Response.Write("<script language=\"Javascript\">var win=window.open('" + strFileName +"',null,'width=510,height=255,top=250,left=250','true');</script>"); }//if (strResult.Contains("Null")) lblMessage.Text ="No file was returned. More information: " + strResult;else lblMessage.Text = strResult; }

So the file comes out of the database, into a folder and then has to be shown in a new window. It looks fine until I ran it and I get a JavaScript error saying: "Access Denied". I went on to change the permissions on the folder (mind you I am running this not on IIS but using the feature that VS2005 has) where the file gets saved, allowing "All" to read, yet nothing. Could somebody give me some pointers?

Thanks!

|||

Hi Kevin,

Well, my "dilema" is similar. Basically instead of showing the content on the same page that made the request (let′s say on page 'A', where page 'A' has a button that says "select") I need to show my content on a new page. So far I have this:

void gv_SelectedIndexChanging(object sender, GridViewSelectEventArgs e) { String strResult ="", strExtension =""; String strDirectory, strFileName; GridView view = (GridView)sender; Guid __ID =new Guid(view.Rows[e.NewSelectedIndex].Cells[1].Text); Content c =new Content(Connection, __ID);// Byte[] btArray = c.GetFile(ref strResult,out strExtension);if (btArray !=null) { strDirectory ="ContentFiles"; strFileName = Page.Request.PhysicalApplicationPath; strFileName = strFileName + strDirectory;if (!System.IO.Directory.Exists(strFileName)) System.IO.Directory.CreateDirectory(strFileName); strFileName +="\\" +"content" + c.HumanNumber + strExtension;// System.IO.FileStream fs;if (!System.IO.File.Exists(strFileName)) fs = System.IO.File.Create(strFileName);else fs =new System.IO.FileStream(strFileName, System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.Write);// System.IO.BinaryWriter writer =new System.IO.BinaryWriter(fs); writer.Write(btArray); writer.Flush(); writer.Close(); fs.Close(); Page.Response.Write("<script language=\"Javascript\">var win=window.open('" + strFileName +"',null,'width=510,height=255,top=250,left=250','true');</script>"); }//if (strResult.Contains("Null")) lblMessage.Text ="No file was returned. More information: " + strResult;else lblMessage.Text = strResult; }

So the file comes out of the database, into a folder and then has to be shown in a new window. It looks fine until I ran it and I get a JavaScript error saying: "Access Denied". I went on to change the permissions on the folder (mind you I am running this not on IIS but using the feature that VS2005 has) where the file gets saved, allowing "All" to read, yet nothing. Could somebody give me some pointers?

Thanks!

|||

void gv_SelectedIndexChanging(object sender, GridViewSelectEventArgs e) { String strResult ="", strExtension =""; String strDirectory, strFileName, strUrl; GridView view = (GridView)sender; Guid __ID =new Guid(view.Rows[e.NewSelectedIndex].Cells[1].Text); Content c =new Content(Connection, __ID);// Byte[] btArray = c.GetFile(ref strResult,out strExtension);if (btArray !=null) { strDirectory = Page.Request.PhysicalApplicationPath +"ContentFiles\\";if (!System.IO.Directory.Exists(strDirectory)) System.IO.Directory.CreateDirectory(strDirectory); strFileName ="content" + c.HumanNumber + strExtension;// System.IO.FileStream fs;if (!System.IO.File.Exists(strDirectory + strFileName)) fs = System.IO.File.Create(strDirectory + strFileName);else fs =new System.IO.FileStream(strDirectory + strFileName, System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.Write);// System.IO.BinaryWriter writer =new System.IO.BinaryWriter(fs); writer.Write(btArray); writer.Flush(); writer.Close(); fs.Close(); strUrl = Page.Request.Url.ToString(); strUrl = strUrl.Remove(strUrl.LastIndexOf('/'), strUrl.Length - strUrl.LastIndexOf('/')); strUrl +="/ContentFiles/"; Page.Response.Write("<script language=\"Javascript\">" +"var win=window.open('" + strUrl + strFileName +"',null,'width=510,height=255,top=250,left=250','true');" +"</script>"); }//if (strResult.Contains("Null")) lblMessage.Text ="No file was returned. More information: " + strResult;else lblMessage.Text = strResult; }
Hi all;

I've solved the problem. To solve it I had to store the file where the page was executing (Page.Request.PhysicalApplicationPath) and then surf it by the address of the current page (Page.Request.Url.ToString()) plus the name of the file. Unfortunatelly, since my web part will go inside a Sharepoint 2007, this aproach doesn't work because I can′t surf tohttp://sharepoint/SiteDirectory/mydepartment/Content%20%20Contents/ContentFiles/contentVD00005000.pdf. The file gets stored under C:\Inetpub\wwwroot\wss\VirtualDirectories\80\ContentFiles, now the million dollar questions is, how do you get to see the file? For those who want to see the code, it is above. If anybody can help me with popup windows and Sharepoint 2007 web parts that will be awesome.

Cheers,

|||

Kevin Yu - MSFT:

Hi angshujit,

You can use System.IO.File.Delete() method to delete the file. You need to make sure that the file has been downloaded to the client. Then you can delete the source file.

Just curious,

How would you make sure the file has been dowloaded to the client?

Thanks

/Kadji