473,324 Members | 2,313 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

OLEDB implemintation question

I working with Excel file by using the OLEDB components such :
OleDbConnection ,OleDbCommand.
I successfuly read/update the Excel table.
The problem is how can I change the color of spicific location, I can update
spicifc value by somthing like :
_oleCmdUpdate =new OleDbCommand(
@" Update ["
+ _strSheetName
"$" + _strSheetRange
+ "] set F1=" + strVal, _oleConn);

How can I change color this spicific location in Excel table, I find
somthing in VB not C# , any one can convert tho following VB code to C# ? How
can do the same in C#?

Sub ColorCells()
On Error Resume Next
With Sheet1.UsedRange
.SpecialCells(xlCellTypeFormulas).Font.Color = vbBlack
.SpecialCells(xlCellTypeConstants).Font.Color = vbBlue
End With
On Error GoTo 0
End Sub
Nov 17 '05 #1
4 2129
void ColorCells()
{
try
{
Sheet1.UsedRange.SpecialCells[xlCellTypeFormulas].Font.Color =
vbBlack
Sheet1.UsedRange..SpecialCells[xlCellTypeConstants].Font.Color =
vbBlue
}
catch
{
}
}

Not quite sure if it should be
Sheet1.UsedRange.SpecialCells[xlCellTypeFormulas] or
Sheet1.UsedRange.SpecialCells(xlCellTypeFormulas)
See which one works

--
Alex Feinman
---
Visit http://www.opennetcf.org
"[Yosi]" <Yo**@discussions.microsoft.com> wrote in message
news:98**********************************@microsof t.com...
I working with Excel file by using the OLEDB components such :
OleDbConnection ,OleDbCommand.
I successfuly read/update the Excel table.
The problem is how can I change the color of spicific location, I can
update
spicifc value by somthing like :
_oleCmdUpdate =new OleDbCommand(
@" Update ["
+ _strSheetName
"$" + _strSheetRange
+ "] set F1=" + strVal, _oleConn);

How can I change color this spicific location in Excel table, I find
somthing in VB not C# , any one can convert tho following VB code to C# ?
How
can do the same in C#?

Sub ColorCells()
On Error Resume Next
With Sheet1.UsedRange
.SpecialCells(xlCellTypeFormulas).Font.Color = vbBlack
.SpecialCells(xlCellTypeConstants).Font.Color = vbBlue
End With
On Error GoTo 0
End Sub


Nov 17 '05 #2
How this become an OLEdb commands ?
I don't have sheet1 , to access sheet1 I should do somthing like :
_oleCmdSelect =new OleDbCommand(
@"SELECT * FROM ["
+ _strSheetName
+ "$" + _strSheetRange
+ "]", _oleConn);

How can I merge your code to such a commands for OLEDB transactions ?
Your Sheet1 is Excel.Worksheet Sheet1 but I don't use Excel namespace,
This exactly what I need how to do the same using OLEDB ?
Thx.
"Alex Feinman [MVP]" wrote:
void ColorCells()
{
try
{
Sheet1.UsedRange.SpecialCells[xlCellTypeFormulas].Font.Color =
vbBlack
Sheet1.UsedRange..SpecialCells[xlCellTypeConstants].Font.Color =
vbBlue
}
catch
{
}
}

Not quite sure if it should be
Sheet1.UsedRange.SpecialCells[xlCellTypeFormulas] or
Sheet1.UsedRange.SpecialCells(xlCellTypeFormulas)
See which one works

--
Alex Feinman
---
Visit http://www.opennetcf.org
"[Yosi]" <Yo**@discussions.microsoft.com> wrote in message
news:98**********************************@microsof t.com...
I working with Excel file by using the OLEDB components such :
OleDbConnection ,OleDbCommand.
I successfuly read/update the Excel table.
The problem is how can I change the color of spicific location, I can
update
spicifc value by somthing like :
_oleCmdUpdate =new OleDbCommand(
@" Update ["
+ _strSheetName
"$" + _strSheetRange
+ "] set F1=" + strVal, _oleConn);

How can I change color this spicific location in Excel table, I find
somthing in VB not C# , any one can convert tho following VB code to C# ?
How
can do the same in C#?

Sub ColorCells()
On Error Resume Next
With Sheet1.UsedRange
.SpecialCells(xlCellTypeFormulas).Font.Color = vbBlack
.SpecialCells(xlCellTypeConstants).Font.Color = vbBlue
End With
On Error GoTo 0
End Sub


Nov 17 '05 #3
As told you before, you can't use the Excel object model without having
Excel installed, that means you can't access workbook/sheet properties.
Using OLEDB and the text provider only allows you to access the data in a
file in tabular form (like an Excel spreadsheet), but that's it.

Willy.

"[Yosi]" <Yo**@discussions.microsoft.com> wrote in message
news:82**********************************@microsof t.com...
How this become an OLEdb commands ?
I don't have sheet1 , to access sheet1 I should do somthing like :
_oleCmdSelect =new OleDbCommand(
@"SELECT * FROM ["
+ _strSheetName
+ "$" + _strSheetRange
+ "]", _oleConn);

How can I merge your code to such a commands for OLEDB transactions ?
Your Sheet1 is Excel.Worksheet Sheet1 but I don't use Excel namespace,
This exactly what I need how to do the same using OLEDB ?
Thx.
"Alex Feinman [MVP]" wrote:
void ColorCells()
{
try
{
Sheet1.UsedRange.SpecialCells[xlCellTypeFormulas].Font.Color =
vbBlack
Sheet1.UsedRange..SpecialCells[xlCellTypeConstants].Font.Color =
vbBlue
}
catch
{
}
}

Not quite sure if it should be
Sheet1.UsedRange.SpecialCells[xlCellTypeFormulas] or
Sheet1.UsedRange.SpecialCells(xlCellTypeFormulas)
See which one works

--
Alex Feinman
---
Visit http://www.opennetcf.org
"[Yosi]" <Yo**@discussions.microsoft.com> wrote in message
news:98**********************************@microsof t.com...
>I working with Excel file by using the OLEDB components such :
> OleDbConnection ,OleDbCommand.
> I successfuly read/update the Excel table.
> The problem is how can I change the color of spicific location, I can
> update
> spicifc value by somthing like :
> _oleCmdUpdate =new OleDbCommand(
> @" Update ["
> + _strSheetName
> "$" + _strSheetRange
> + "] set F1=" + strVal, _oleConn);
>
> How can I change color this spicific location in Excel table, I find
> somthing in VB not C# , any one can convert tho following VB code to C#
> ?
> How
> can do the same in C#?
>
> Sub ColorCells()
> On Error Resume Next
> With Sheet1.UsedRange
> .SpecialCells(xlCellTypeFormulas).Font.Color = vbBlack
> .SpecialCells(xlCellTypeConstants).Font.Color = vbBlue
> End With
> On Error GoTo 0
> End Sub
>
>


Nov 17 '05 #4
"Using OLEDB and the text provider only allows you to access the data in a
file in tabular form (like an Excel spreadsheet), but that's it." : this
clarify everything.

"that means you can't access workbook/sheet properties.Using OLEDB" : I
didn't read such before .

Any way I get think I have all the information for how to use the Excel, now
my app can decide whether to use Excel library or OLEODB depending on the
local machine includes Excel app or not.

Thanks a lot.

Regards,
Yosef
"Willy Denoyette [MVP]" wrote:
As told you before, you can't use the Excel object model without having
Excel installed, that means you can't access workbook/sheet properties.
Using OLEDB and the text provider only allows you to access the data in a
file in tabular form (like an Excel spreadsheet), but that's it.

Willy.

"[Yosi]" <Yo**@discussions.microsoft.com> wrote in message
news:82**********************************@microsof t.com...
How this become an OLEdb commands ?
I don't have sheet1 , to access sheet1 I should do somthing like :
_oleCmdSelect =new OleDbCommand(
@"SELECT * FROM ["
+ _strSheetName
+ "$" + _strSheetRange
+ "]", _oleConn);

How can I merge your code to such a commands for OLEDB transactions ?
Your Sheet1 is Excel.Worksheet Sheet1 but I don't use Excel namespace,
This exactly what I need how to do the same using OLEDB ?
Thx.
"Alex Feinman [MVP]" wrote:
void ColorCells()
{
try
{
Sheet1.UsedRange.SpecialCells[xlCellTypeFormulas].Font.Color =
vbBlack
Sheet1.UsedRange..SpecialCells[xlCellTypeConstants].Font.Color =
vbBlue
}
catch
{
}
}

Not quite sure if it should be
Sheet1.UsedRange.SpecialCells[xlCellTypeFormulas] or
Sheet1.UsedRange.SpecialCells(xlCellTypeFormulas)
See which one works

--
Alex Feinman
---
Visit http://www.opennetcf.org
"[Yosi]" <Yo**@discussions.microsoft.com> wrote in message
news:98**********************************@microsof t.com...
>I working with Excel file by using the OLEDB components such :
> OleDbConnection ,OleDbCommand.
> I successfuly read/update the Excel table.
> The problem is how can I change the color of spicific location, I can
> update
> spicifc value by somthing like :
> _oleCmdUpdate =new OleDbCommand(
> @" Update ["
> + _strSheetName
> "$" + _strSheetRange
> + "] set F1=" + strVal, _oleConn);
>
> How can I change color this spicific location in Excel table, I find
> somthing in VB not C# , any one can convert tho following VB code to C#
> ?
> How
> can do the same in C#?
>
> Sub ColorCells()
> On Error Resume Next
> With Sheet1.UsedRange
> .SpecialCells(xlCellTypeFormulas).Font.Color = vbBlack
> .SpecialCells(xlCellTypeConstants).Font.Color = vbBlue
> End With
> On Error GoTo 0
> End Sub
>
>


Nov 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: | last post by:
Hi, I was performing SQL UPDATE queries and I notice that they SUCCEED on the ExecuteNonQuery() call with NO exceptions raised BUT they fail at the Database. They say they succeed in the code...
2
by: Joe | last post by:
Hi All, I am new to using the Access DB and I need some help if someone is able to give it to me. What I want to do is get the names of the columns of certain tables. Not the data in the table...
9
by: Pam Ammond | last post by:
I need the code to update the database when Save is clicked and a text field has changed. This should be very easy since I used Microsoft's wizards for the OleDBAdapter and OleDBConnection, and...
1
by: Brian Henry | last post by:
I have an access database, and one of the fields in the table I am inserting into has a date/time data type. What is the correct OleDb data type to insert the date and time that it is at the moment...
3
by: Brian Foree | last post by:
I am developing an ASP.NET application that uses Access 2000 as its backend, and have just started getting the following error on 2 ASP.NET pages that had been working until late last week (and I...
0
by: NicK chlam via DotNetMonster.com | last post by:
this is the error i get System.Data.OleDb.OleDbException: Syntax error in INSERT INTO statement. at System.Data.Common.DbDataAdapter.Update(DataRow dataRows, DataTableMapping tableMapping) at...
3
by: asemeiks | last post by:
I'm using Access 97, Jet 4.0. the data resides on a Win 2000 domain server. Using .Net 1.1 and IIS 5.0 on a local XPPro computer I am trying connect to a Jet database on the server. If the data...
3
by: Allen | last post by:
I want to learn a little about database software. I have a nice example that uses System.Data.OleDb. I'd like to study it and extend it into something I can use. It's a vs2003 solution. ...
2
by: Miles | last post by:
I have a VB2005 application that has the need to read FoxPro 2.5 DBF/CDX files. I have the code (below) that opens the connection, but there are never any records, nor errors, reported... Can...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.