Showing posts with label ole. Show all posts
Showing posts with label ole. Show all posts

Sunday, March 11, 2012

Code works differently based on the provider

Hello

The following code does not function if I use SQLOLEDB if I omit the provide and default to ODBC OLE DB it works correctly. I am assume I am coding something wrong for a SQLOLEDB provide. Any help is greatly appricated.

VB Code


Public Function SqlExecuteResult(xSQL As String, sServer As String, sDatabase As String, sUserName As String, sPassword As String, sCaller As String, Optional bLog As Boolean = False) As Object

Dim oDB As Object
Dim oRS As Object

Set oDB = CreateObject("adodb.connection")
Set oRS = CreateObject("adodb.recordset")

oDB.open "driver={SQL Server};provider=sqloledb;server=" & sServer & ";database=" & sDatabase & ";uid=" & sUserName & ";pwd=" & sPassword & ";"
oRS.CursorLocation = adUseClient
oRS.CursorType = adOpenStatic
Set oRS.ActiveConnection = oDB
oRS.open xSQL
Set oRS.ActiveConnection = Nothing
Set SqlExecuteResult = oRS
oDB.Close
Set oDB = Nothing

End Function


Private Sub Form_Load()
Dim rs As Object
Set rs = SqlExecuteResult("exec NextEntry 'SentMessages'", "surecomp-bob", "pmsureus33", "sa", "", "")
MsgBox rs.fields(0)
End Sub

SQL proceedure

CREATE PROCEDURE NextEntry @.CounterName Varchar(20) AS

begin
declare @.counter int
select @.counter = counter from counters where countername = @.counterName
select @.counter = @.counter + 1
update counters set counter = @.counter where countername = @.countername
select counter from counters where countername = @.counterName
End
GO

Thanks

Bob Jenkin

Are you having both "driver=" and "provider=sqloledb" in the connection string?
If you specified sqloledb you should have removed "driver=" part.

Thursday, March 8, 2012

Code Page

Hello,

I am getting following error

Error: 0xC02020F4 at Data Flow Task, OLE DB Source [1]: The column "dbname" cannot be processed because more than one code page (936 and 1252) are specified for it.

Error: 0xC02020F4 at Data Flow Task, OLE DB Source [1]: The column "dbsize" cannot be processed because more than one code page (936 and 1252) are specified for it.

Error: 0xC02020F4 at Data Flow Task, OLE DB Source [1]: The column "Owner" cannot be processed because more than one code page (936 and 1252) are specified for it.

Error: 0xC02020F4 at Data Flow Task, OLE DB Source [1]: The column "Status" cannot be processed because more than one code page (936 and 1252) are specified for it.

Error: 0xC02020F4 at Data Flow Task, OLE DB Source [1]: The column "CompLevel" cannot be processed because more than one code page (936 and 1252) are specified for it.

When I run the package itself it is working fine and when I am calling the package from another package getting this error. From Parent package I sending servername for olde db source to this package.

Thanks.

hi Faran

Try by setting "AlwaysUseDefaultCodePage" property of oledb source as true.

Thanks and regards

Rahul Kumar, Software Engineer, India

|||

I also experienced the following error message:

The column "%1!s!" cannot be processed because more than one code page (%2!d! and %3!d!) are specified for it.

Here are the details of my case:

BACKGROUND
While building SSIS packages graphically within VS 2005 design mode, a metadata code behind page is modified to reflect the graphical controls used within the designer. It is here within the metadata code-behind where controls reference their parent page with a page number. Each SSIS package has a code-behind with a default page number. Different SSIS packages should have different page numbers.


CAUSE
I was working with one SSIS package and created a second package that would use some of the configured controls from the first package. By copying controls from the first package to the second package, I ended up with several controls using the page number from its source. So, when I attempted to debug the second package I received the following message:

The column "ProductId" cannot be processed because more than one code page (1252 and 65001) are specified for it.

In short the first SSIS package had a page number of 1252 and the second SSIS package had a page number of 65001. So all of the controls copied from the first package retained their 1252 page number references.

SOLUTION
I edited the metadata code-behind by replacing all 1252 page number references with 65001.

This solution worked for me and I hope others will find it useful.

|||

How to set the "AlwaysUseDefaultCodePage" property?

Thank you.

|||

In your data flow transformation, in the properties window of the ole db source or destination you can set this.

Thanks

|||

I faced similar problem and "AlwaysUseDefaultCodePage" work fine with me and fix my problem.

you are great man (Y)

thanks

Code Page

Hello,

I am getting following error

Error: 0xC02020F4 at Data Flow Task, OLE DB Source [1]: The column "dbname" cannot be processed because more than one code page (936 and 1252) are specified for it.

Error: 0xC02020F4 at Data Flow Task, OLE DB Source [1]: The column "dbsize" cannot be processed because more than one code page (936 and 1252) are specified for it.

Error: 0xC02020F4 at Data Flow Task, OLE DB Source [1]: The column "Owner" cannot be processed because more than one code page (936 and 1252) are specified for it.

Error: 0xC02020F4 at Data Flow Task, OLE DB Source [1]: The column "Status" cannot be processed because more than one code page (936 and 1252) are specified for it.

Error: 0xC02020F4 at Data Flow Task, OLE DB Source [1]: The column "CompLevel" cannot be processed because more than one code page (936 and 1252) are specified for it.

When I run the package itself it is working fine and when I am calling the package from another package getting this error. From Parent package I sending servername for olde db source to this package.

Thanks.

hi Faran

Try by setting "AlwaysUseDefaultCodePage" property of oledb source as true.

Thanks and regards

Rahul Kumar, Software Engineer, India

|||

I also experienced the following error message:

The column

"%1!s!" cannot be processed because more than one code page (%2!d!

and %3!d!) are specified for it.

Here are the details

of my case:

BACKGROUND
While building SSIS

packages graphically within VS 2005 design mode, a metadata code behind page is

modified to reflect the graphical controls used within the designer. It is here

within the metadata code-behind where controls reference their parent page with

a page number. Each SSIS package has a code-behind with a default page number.

Different SSIS packages should have different page numbers.


CAUSE
I was working with

one SSIS package and created a second package that would use some of the

configured controls from the first package. By copying controls from the first

package to the second package, I ended up with several controls using the page

number from its source. So, when I attempted to debug the second package I

received the following message:

The column "ProductId"

cannot be processed because more than one code page (1252 and 65001) are

specified for it.

In short the first

SSIS package had a page number of 1252 and the second SSIS package had a page

number of 65001. So all of the controls copied from the first package retained

their 1252 page number references.

SOLUTION
I edited the metadata

code-behind by replacing all 1252 page number references with 65001.

This solution worked

for me and I hope others will find it useful.

|||

How to set the "AlwaysUseDefaultCodePage" property?

Thank you.

|||

In your data flow transformation, in the properties window of the ole db source or destination you can set this.

Thanks

Code Page

Hello,

I am getting following error

Error: 0xC02020F4 at Data Flow Task, OLE DB Source [1]: The column "dbname" cannot be processed because more than one code page (936 and 1252) are specified for it.

Error: 0xC02020F4 at Data Flow Task, OLE DB Source [1]: The column "dbsize" cannot be processed because more than one code page (936 and 1252) are specified for it.

Error: 0xC02020F4 at Data Flow Task, OLE DB Source [1]: The column "Owner" cannot be processed because more than one code page (936 and 1252) are specified for it.

Error: 0xC02020F4 at Data Flow Task, OLE DB Source [1]: The column "Status" cannot be processed because more than one code page (936 and 1252) are specified for it.

Error: 0xC02020F4 at Data Flow Task, OLE DB Source [1]: The column "CompLevel" cannot be processed because more than one code page (936 and 1252) are specified for it.

When I run the package itself it is working fine and when I am calling the package from another package getting this error. From Parent package I sending servername for olde db source to this package.

Thanks.

hi Faran

Try by setting "AlwaysUseDefaultCodePage" property of oledb source as true.

Thanks and regards

Rahul Kumar, Software Engineer, India

|||

I also experienced the following error message:

The column

"%1!s!" cannot be processed because more than one code page (%2!d!

and %3!d!) are specified for it.

Here are the details

of my case:

BACKGROUND
While building SSIS

packages graphically within VS 2005 design mode, a metadata code behind page is

modified to reflect the graphical controls used within the designer. It is here

within the metadata code-behind where controls reference their parent page with

a page number. Each SSIS package has a code-behind with a default page number.

Different SSIS packages should have different page numbers.


CAUSE
I was working with

one SSIS package and created a second package that would use some of the

configured controls from the first package. By copying controls from the first

package to the second package, I ended up with several controls using the page

number from its source. So, when I attempted to debug the second package I

received the following message:

The column "ProductId"

cannot be processed because more than one code page (1252 and 65001) are

specified for it.

In short the first

SSIS package had a page number of 1252 and the second SSIS package had a page

number of 65001. So all of the controls copied from the first package retained

their 1252 page number references.

SOLUTION
I edited the metadata

code-behind by replacing all 1252 page number references with 65001.

This solution worked

for me and I hope others will find it useful.

|||

How to set the "AlwaysUseDefaultCodePage" property?

Thank you.

|||

In your data flow transformation, in the properties window of the ole db source or destination you can set this.

Thanks

Code Page

Hello,

I am getting following error

Error: 0xC02020F4 at Data Flow Task, OLE DB Source [1]: The column "dbname" cannot be processed because more than one code page (936 and 1252) are specified for it.

Error: 0xC02020F4 at Data Flow Task, OLE DB Source [1]: The column "dbsize" cannot be processed because more than one code page (936 and 1252) are specified for it.

Error: 0xC02020F4 at Data Flow Task, OLE DB Source [1]: The column "Owner" cannot be processed because more than one code page (936 and 1252) are specified for it.

Error: 0xC02020F4 at Data Flow Task, OLE DB Source [1]: The column "Status" cannot be processed because more than one code page (936 and 1252) are specified for it.

Error: 0xC02020F4 at Data Flow Task, OLE DB Source [1]: The column "CompLevel" cannot be processed because more than one code page (936 and 1252) are specified for it.

When I run the package itself it is working fine and when I am calling the package from another package getting this error. From Parent package I sending servername for olde db source to this package.

Thanks.

hi Faran

Try by setting "AlwaysUseDefaultCodePage" property of oledb source as true.

Thanks and regards

Rahul Kumar, Software Engineer, India

|||

I also experienced the following error message:

The column "%1!s!" cannot be processed because more than one code page (%2!d! and %3!d!) are specified for it.

Here are the details of my case:

BACKGROUND
While building SSIS packages graphically within VS 2005 design mode, a metadata code behind page is modified to reflect the graphical controls used within the designer. It is here within the metadata code-behind where controls reference their parent page with a page number. Each SSIS package has a code-behind with a default page number. Different SSIS packages should have different page numbers.


CAUSE
I was working with one SSIS package and created a second package that would use some of the configured controls from the first package. By copying controls from the first package to the second package, I ended up with several controls using the page number from its source. So, when I attempted to debug the second package I received the following message:

The column "ProductId" cannot be processed because more than one code page (1252 and 65001) are specified for it.

In short the first SSIS package had a page number of 1252 and the second SSIS package had a page number of 65001. So all of the controls copied from the first package retained their 1252 page number references.

SOLUTION
I edited the metadata code-behind by replacing all 1252 page number references with 65001.

This solution worked for me and I hope others will find it useful.

|||

How to set the "AlwaysUseDefaultCodePage" property?

Thank you.

|||

In your data flow transformation, in the properties window of the ole db source or destination you can set this.

Thanks

|||

I faced similar problem and "AlwaysUseDefaultCodePage" work fine with me and fix my problem.

you are great man (Y)

thanks