Showing posts with label excel. Show all posts
Showing posts with label excel. Show all posts

Wednesday, March 28, 2012

How to Save MS Word/Excel Files in Database?

Dear all, i have a problem.

i have to save a word doc or an excel file in the database in the module given to me where .net is the platform that i am using, can some one help me out in this.
thanks in advance

Regards
PuligaHi Puliga,

Have you found the answer yet?
I like to do the same over here.

regards
Pleun|||I would suggest storing full path to those files only and not files them selves.
Even if you will manage storing data in a database, you will encounter slowness in retrieving those documents and will convert to my first idea anyway... :)

Monday, March 26, 2012

How to save Excel spreadsheet in SQL Database

I need to understand how I can save an excel spreadsheet in the SQL 7.0 db.
Am I trying to save the XLS file or just a link to it' I have a VB6 front
end to the SQL database.
ThanksYou're probably better off saving a link to the XLS, depending on what
you're doing with it in your application. The links are easier to
store and retrieve and you don't have to deal with the overhead of
storing and retrieving large binary objects in your database.
-- Mary
MCW Technologies
http://www.mcwtech.com
On Fri, 23 Jan 2004 12:31:43 -0600, "ddg1950" <dgoncher@.clearlam.com>
wrote:
quote:

>I need to understand how I can save an excel spreadsheet in the SQL 7.0 db.
>Am I trying to save the XLS file or just a link to it' I have a VB6 fron
t
>end to the SQL database.
>Thanks
>

How to save a dataset to a sql server table?

Scenario: I have created a dataset from an excel file to display it on a screen. Now I would like to save this same dataset in a SQL Server table.

Any ideas would be greatly appreciated.

Thanks

Data Set = One or More table(s).

Create a table in SQL Server that has same headers (same number of columns and same data types).

Iterate through your dataset table(s): MyDataSet.Tables[i]

Read each column from that table, and save its value in SQL Server.

Idea:

Why not to store the table in SQL Server then show it to user (e.g. by using DTS or SSIS).

Good luck.

|||

Is there any other way than iteracting row by row using the Tables collection of the DataSet?

Note: I am using .NET 1.1

thanks.

|||

hi there.,

i agree with the previous post ... it is better to save / import the date from excel to sql server then to show the data to user... here is how you can import data from spreadsheet to sql... using SqlBulkCopy[if you are using ADO.NET 2.0]

Import / Export Excel Spreadsheet Data into SQL Server Database Table Using SqlBulkCopy

hope it helps./.

|||

Unfortunately, I am using ADO.NET 1.1

Any similar way of doing it? Or other ideas?

Thanks

|||

refer to link below...

How to import data from Excel to SQL Server


|||

Is there any reference to How to import data from excel to sql server database in ADO.NET, instead of microsoft how to ADO and VB6?

Thanks in advance.

|||

Hi,

Actually the solution provided by CS4Ever has already answered the problem. But I don't know what does your "other way than iteracting row by row using the Tables collection of the DataSet" mean?

You have mentioned that you want to use ADO.Net, you have created a DataSet, and you want to save it in the back-end database.

The question has been quite clear, the DataSet is in-memory data container, if you want to save the schema and data in your dataset to your database, you have to build the same table schemas in your database first, and then, calling the update method of dataadapter to update the back-end (In other words, import the data in dataset to back-end). Note, you should keep the status of all rows in dataset as "modified" which indicates that don't call AcceptChanges() before calling Update method.

If you are insist on finding a better way, please show us more details, your needs, or something like "the way in my mind", and reply.

Thanks.

Wednesday, March 7, 2012

How to retrieve the name of the columns?

Hi everyone,

On daily basis I need to generate excerpts by mean of Excel. Prior to sql25k I used to play with Enterprise Manager and pick up the name of all the columns for a table very easily doing this

select top 1 f1,f2,-.. from table

nameage

enric80

How do I such thing from Sql Management Studio?

It's a silly thing, I know, but it's very useful for me because when I've got those columns then I can do paste them perfectly into .XLS.

Otherwise I see forced to write one by one and sometimes tables have more than 60 columns

It's not useful generate a CREATE TABLE script or launch SP_HELP <MYTABLE> because I obtain the name of the columns in vertical no horizontal.

Thanks a lot!!!

Hi Enric

How about this:

EXEC sp_columns @.table_name = 'customers'

Give it a try

Rgds,

Worf

|||select * from information_schema.columns
where table_name = 'customers'|||

Hi guys,

It doesn't useful at all for me. I'm looking for a way which allow me get the columns in horizontal way, just for copy them:

f1 f2 f3 f4

TIA

|||

I gotcha..you can do the same thing in Managment Studio. Just create a new query, and type in:

select top 1 * from Table

that will give you the fields that you want.

|||

hi there,

Ok, setting "results as text" in results panel.

Thanks

|||

Declare @.columns nvarchar(max)

Select @.columns = IsNull(@.columns + ', ', '') + column_name

From information_schema.columns

Where table_name = 'customers'

Select @.columns

-- or

Print @.columns

Friday, February 24, 2012

How to retreive data from Excel to SQL SERVER Database table

Hi Friends,

I am Using SQL SERVER 2005

I need to retreive data from Excel file to SQLSERVER table..

Thanks in advance

Regards

Rajkumar.M

There are many ways to do this. You may use SQL Server integration services, or you may create a persistent connection to any data source supporting OLE DB (including MS Excel) via linked servers, or you may use OPENDATASOURCE clause in your query.

http://support.microsoft.com/kb/321686 will help you start.

How to retreive data from Excel into SQLSERVER database table

Hi friends,

I need to retreive data from Excel into SQLSERVER database table

give me reply asap.

Thanks in advance...

you can do it, using SqlBulkCopy using ADO.NET

I have developed a small tool in C# that can work for you,

I have tested it using sql server 2000/2005 and works ok
but you require Framework 2.0

so if you wanna test it, just mail me
vish4forum at yahoo dot com. I will send you that exe

|||

Hi Vish,

I found ur reply useful..

please send me sample code that will be better

|||

Hi Vish,

I tried using SQLBulk copy..But i got error 'could not find installable ISAM'

Here is my code

string excelConnectionString = @."Provider=Microsoft.Jet.OLEDB.4.0;Data Source=192.168.0.25;Extended
Properties=""Excel 11.0;HDR=YES;IMEX=1;""";

OleDbConnection con = new OleDbConnection(excelConnectionString);


con.Open();
OleDbCommand cmd = new OleDbCommand("select * from [test$]", con);
dr = cmd.ExecuteReader();

SqlConnection con1 = new SqlConnection();
con1.ConnectionString = System.Configuration.ConfigurationManager.AppSettings["strcon"];
con1.Open();
SqlBulkCopy bulk1 = new SqlBulkCopy(con1);
bulk1.DestinationTableName = "tblexcel";
bulk1.WriteToServer(dr);
Response.Write("Loaded");

|||

Checkout this two articles

1)http://davidhayden.com/blog/dave/archive/2006/05/31/2976.aspx

2)http://support.microsoft.com/kb/321686

hope this helps !!!

Sunday, February 19, 2012

How to restrict access our DB on SQL server.

Hi,
How can we restrict our DB if connecting thru other applications like SQL query analyzer, Excel & even Enterprise manager?
but this DB should be accessible by our application (from front end) only...
I learned about "Application Role" in SQL server 2000 but to apply this
we will have to change our code thousand places.
Have any idea...Pl. do suggest?
Thanx in advance!!!!
Regards,
Paresh...
Message posted via http://www.sqlmonster.com
Don't give out the passwords and they won't be able to login. If they have
a login and password then they can get in and do what ever the current
permissions allow them to.
Andrew J. Kelly SQL MVP
"paresh goyal via SQLMonster.com" <forum@.SQLMonster.com> wrote in message
news:d15479cc26b24cf0a782a131acead60a@.SQLMonster.c om...
> Hi,
> How can we restrict our DB if connecting thru other applications like SQL
> query analyzer, Excel & even Enterprise manager?
> but this DB should be accessible by our application (from front end)
> only...
> I learned about "Application Role" in SQL server 2000 but to apply this
> we will have to change our code thousand places.
> Have any idea...Pl. do suggest?
> Thanx in advance!!!!
> Regards,
> Paresh...
> --
> Message posted via http://www.sqlmonster.com
|||Sounds like you're looking for a solution that might not exist. If your
users that currently use the applications login to SQL with their own
userids, they can use the same userids with any query tool and do whatever
they have permissions for. You could try to use different ports, server
aliases, etc... to make it tougher for them to discover where the actual
sql db sits but it's just a speed bump, not a barrier.
aK.
"paresh goyal via SQLMonster.com" <forum@.SQLMonster.com> wrote in message
news:d15479cc26b24cf0a782a131acead60a@.SQLMonster.c om...
> Hi,
> How can we restrict our DB if connecting thru other applications like SQL
query analyzer, Excel & even Enterprise manager?
> but this DB should be accessible by our application (from front end)
only...
> I learned about "Application Role" in SQL server 2000 but to apply this
> we will have to change our code thousand places.
> Have any idea...Pl. do suggest?
> Thanx in advance!!!!
> Regards,
> Paresh...
> --
> Message posted via http://www.sqlmonster.com