ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Writing a serries of values... (https://www.excelbanter.com/excel-programming/367677-writing-serries-values.html)

basulasz

Writing a serries of values...
 
I get a serries of values from db. And i want to write these values to cells
in a sheet. For example i will start from A1 and i will write 10 values
through A1-A10. I am new in this kind of excel programming. May be it is an
easy question but i fail. What should i do, to do that?

Thanks a lot...

Tom Ogilvy

Writing a serries of values...
 
show the code that gets the values from db.

Otherwise, look at example code for use ADO to read a data set:

http://www.rondebruin.nl/accessexcel.htm


http://www.erlandsendata.no/english/...php?t=envbadac


--
Regards,
Tom Ogilvy


"basulasz" wrote:

I get a serries of values from db. And i want to write these values to cells
in a sheet. For example i will start from A1 and i will write 10 values
through A1-A10. I am new in this kind of excel programming. May be it is an
easy question but i fail. What should i do, to do that?

Thanks a lot...


basulasz

Writing a serries of values...
 
I use c# and VSTO, here is the code;

sqlCommand1.CommandText = txtQuery.Text;

sqlConnection1.Open();
SqlDataReader dr_Read = sqlCommand1.ExecuteReader();
while (dr_Read.Read())
al_Fiy.Add(dr_Read[0].ToString());
dr_Read.Close();
sqlConnection1.Close();

I just write values to an arraylist;

And i think i should use a Named Range like this

Microsoft.Office.Tools.Excel.NamedRange nr =
this.Controls.AddNamedRange(this.Range["B9",missing], "NamedRange1");

nr.Value2 = "Hello World";

writing values begginning from B9 and up to end of the arraylist is my problem


Tom Ogilvy

Writing a serries of values...
 
I don't currently use C# and/or VSTO, so I don't have any advice for you.

Most questions in this group are about VBA, so you would do well to state in
your initial post that you are using C# and VSTO and you will have better
luck getting a response from someone who can answer your question. Sorry.

--
Regards,
Tom Ogilvy


"basulasz" wrote:

I use c# and VSTO, here is the code;

sqlCommand1.CommandText = txtQuery.Text;

sqlConnection1.Open();
SqlDataReader dr_Read = sqlCommand1.ExecuteReader();
while (dr_Read.Read())
al_Fiy.Add(dr_Read[0].ToString());
dr_Read.Close();
sqlConnection1.Close();

I just write values to an arraylist;

And i think i should use a Named Range like this

Microsoft.Office.Tools.Excel.NamedRange nr =
this.Controls.AddNamedRange(this.Range["B9",missing], "NamedRange1");

nr.Value2 = "Hello World";

writing values begginning from B9 and up to end of the arraylist is my problem



All times are GMT +1. The time now is 11:24 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com