473,549 Members | 2,408 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.UsedRang e
.SpecialCells(x lCellTypeFormul as).Font.Color = vbBlack
.SpecialCells(x lCellTypeConsta nts).Font.Color = vbBlue
End With
On Error GoTo 0
End Sub
Nov 17 '05 #1
4 2153
void ColorCells()
{
try
{
Sheet1.UsedRang e.SpecialCells[xlCellTypeFormu las].Font.Color =
vbBlack
Sheet1.UsedRang e..SpecialCells[xlCellTypeConst ants].Font.Color =
vbBlue
}
catch
{
}
}

Not quite sure if it should be
Sheet1.UsedRang e.SpecialCells[xlCellTypeFormu las] or
Sheet1.UsedRang e.SpecialCells( xlCellTypeFormu las)
See which one works

--
Alex Feinman
---
Visit http://www.opennetcf.org
"[Yosi]" <Yo**@discussio ns.microsoft.co m> wrote in message
news:98******** *************** ***********@mic rosoft.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.UsedRang e
.SpecialCells(x lCellTypeFormul as).Font.Color = vbBlack
.SpecialCells(x lCellTypeConsta nts).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.UsedRang e.SpecialCells[xlCellTypeFormu las].Font.Color =
vbBlack
Sheet1.UsedRang e..SpecialCells[xlCellTypeConst ants].Font.Color =
vbBlue
}
catch
{
}
}

Not quite sure if it should be
Sheet1.UsedRang e.SpecialCells[xlCellTypeFormu las] or
Sheet1.UsedRang e.SpecialCells( xlCellTypeFormu las)
See which one works

--
Alex Feinman
---
Visit http://www.opennetcf.org
"[Yosi]" <Yo**@discussio ns.microsoft.co m> wrote in message
news:98******** *************** ***********@mic rosoft.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.UsedRang e
.SpecialCells(x lCellTypeFormul as).Font.Color = vbBlack
.SpecialCells(x lCellTypeConsta nts).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**@discussio ns.microsoft.co m> wrote in message
news:82******** *************** ***********@mic rosoft.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.UsedRang e.SpecialCells[xlCellTypeFormu las].Font.Color =
vbBlack
Sheet1.UsedRang e..SpecialCells[xlCellTypeConst ants].Font.Color =
vbBlue
}
catch
{
}
}

Not quite sure if it should be
Sheet1.UsedRang e.SpecialCells[xlCellTypeFormu las] or
Sheet1.UsedRang e.SpecialCells( xlCellTypeFormu las)
See which one works

--
Alex Feinman
---
Visit http://www.opennetcf.org
"[Yosi]" <Yo**@discussio ns.microsoft.co m> wrote in message
news:98******** *************** ***********@mic rosoft.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.UsedRang e
> .SpecialCells(x lCellTypeFormul as).Font.Color = vbBlack
> .SpecialCells(x lCellTypeConsta nts).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.Usin g 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**@discussio ns.microsoft.co m> wrote in message
news:82******** *************** ***********@mic rosoft.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.UsedRang e.SpecialCells[xlCellTypeFormu las].Font.Color =
vbBlack
Sheet1.UsedRang e..SpecialCells[xlCellTypeConst ants].Font.Color =
vbBlue
}
catch
{
}
}

Not quite sure if it should be
Sheet1.UsedRang e.SpecialCells[xlCellTypeFormu las] or
Sheet1.UsedRang e.SpecialCells( xlCellTypeFormu las)
See which one works

--
Alex Feinman
---
Visit http://www.opennetcf.org
"[Yosi]" <Yo**@discussio ns.microsoft.co m> wrote in message
news:98******** *************** ***********@mic rosoft.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.UsedRang e
> .SpecialCells(x lCellTypeFormul as).Font.Color = vbBlack
> .SpecialCells(x lCellTypeConsta nts).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
3398
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 but they fail at the database. To fix this they Parameters.Add must be called in the ORDER they are in the SQL STATEMENT. This is confusing and...
2
23890
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 but the table column names. I've seen other posts that suggest using the SQL command DESCRIBE but I can't get it to work for some reason. Other...
9
4744
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 DataSet; and all I'm doing is showing one record in text fields, allowing the user to modify the text fields, and then updating the database again...
1
2309
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 that the record was inserted at. I had this, but it gives me a "data type mismatch" error on run. Dim cmdPostQuestion As New...
3
8816
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 don't think I made any changes to either page other than changing the user control that creates the header). Server Error in '/myApp' Application....
0
5630
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 System.Data.Common.DbDataAdapter.Update(DataSet dataSet, String srcTable) at System.Data.Common.DbDataAdapter.Update(DataSet dataSet) at...
3
4255
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 source is on the local computer I can connect ok. If it is is on the server I cannot connect and get the following error. 'Error message. "The...
3
1011
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. My question is: I'm now running vs2005, is OleDb a good way to go or is there a newer and better way then using it?
2
4004
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 anyone tell me what I'm doing wrong? The ConnectionString resolves to "Provider=VFPOLEDB.1;Data Source=C:\test\REVFILEF.DBF;Mode=Read|Share Deny...
0
7467
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7982
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7500
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6066
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5385
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3494
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1961
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1079
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
783
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.