Showing posts with label build. Show all posts
Showing posts with label build. Show all posts

Sunday, March 25, 2012

Connecting to SQL Express 2005 via Web.Config file in Visual Studio 2003

Hi

I am following a project to build a small E-Commerce site from a book I have purchased and I have having problems connecting to the SQL Database with the code supplied.

The book is Apress Beginning ASP.NET 1.1 E-Commerce

http://www.amazon.co.uk/Beginning-ASP-Net-1-1-E-Commerce-Professional/dp/1590592549/ref=sr_11_1/202-7684451-7995058?ie=UTF8&qid=1193780707&sr=11-1

The code added to the Web.Config file is :

<configuration>

<appSettings>

<addkey="ConnectionString"value="Server=(local)\NetSDK;Integrated Security=True;Initial Catalog=JokePoint"/>

</appSettings>

The connection details are in a class file called Catalog.vb and is as follows

Imports System.Data.SqlClient

PublicClass Catalog

PublicSharedFunction GetDepartments()As SqlDataReader

'Create the connection object

Dim connectionAsNew SqlConnection(connectionString)

'Create and initialize the command object

Dim commandAsNew SqlCommand("GetDepartments", connection)

command.CommandType = CommandType.StoredProcedure

'Open the connection

connection.Open()

'Return a SqlDataReader to the calling function

Return command.ExecuteReader(CommandBehavior.CloseConnection)

EndFunction

PrivateSharedReadOnlyProperty connectionString()AsString

Get

Return ConfigurationSettings.AppSettings("ConnectionString")

EndGet

EndProperty

EndClass

The error is....

Cannot open database "JokePoint" requested by the login. The login failed. Login failed for user 'MachineName\ASPNET'.

Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details:System.Data.SqlClient.SqlException: Cannot open database "JokePoint" requested by the login. The login failed. Login failed for user 'MachineName\ASPNET'.

Source Error:

Line 15: 'Open the connectionLine 16:Line 17: connection.Open()Line 18: Line 19: 'Return a SqlDataReader to the calling function


Source File:C:\MyCommerceSite\JokePoint\BusinessObjects\Catalog.vb Line:17

Stack Trace:

[SqlException: Cannot open database "JokePoint" requested by the login. The login failed.Login failed for user 'MachineName\ASPNET'.] System.Data.SqlClient.ConnectionPool.GetConnection(Boolean& isInTransaction) System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction) System.Data.SqlClient.SqlConnection.Open() JokePoint.Catalog.GetDepartments() in C:\MyCommerceSite\JokePoint\BusinessObjects\Catalog.vb:17 JokePoint.DepartmentsList.Page_Load(Object sender, EventArgs e) in C:\MyCommerceSite\JokePoint\UserControls\DepartmentsList.ascx.vb:44 System.Web.UI.Control.OnLoad(EventArgs e) System.Web.UI.Control.LoadRecursive() System.Web.UI.Control.LoadRecursive() System.Web.UI.Control.LoadRecursive() System.Web.UI.Page.ProcessRequestMain()

The connection tests ok in Visual Studio 2003. All permissions are set using SQL Management Studio Express 2005.

The book is using SQL 2000, I have been trying different connection syntax's in the Web.Config file all day and now I have a big headache. I know its something simple, can anyone please advise ?

Thanks in advance.

Mark

cracken:

<addkey="ConnectionString"value="Server=(local)\NetSDK;Integrated Security=True;Initial Catalog=JokePoint"/>

First, you are trying to connect using windows authentication and not with a SQL Server user credentials. I think the Integrated Security part is causing you the error. Have you tried to connect using SQL Server user credentials ( if any ), or you are using the windows authentication only.

Hope this will help.

|||

Try this...

web.config file:

<connectionStrings>

<addname="ConnectionString";Data Source=(local)\NetSDK;Integrated Security=True;Initial Catalog=JokePoint";

providerName="System.Data.SqlClient" />

</connectionStrings>

after that in the vb page:

Dim sepAsNew SqlConnection("connectionstring")

sep.Open()

Dim commandAsNew SqlCommand("GetDepartments", sep)

command.CommandType = CommandType.StoredProcedure

|||

Hi

Thanks for answering so quick, I am using Windows Integrated Secuity at the moment.

I have tried the suggestion above, but they were not sucessful. What I have done is changed the provier to OleDb and added a bit to the connection string.

I do not seen to get any code errors now, just login errors.

The VB file now looks like:

Imports System.Data

Imports System.Data.OleDb.OleDbConnection

Public Class Catalog

Public Shared Function GetDepartments() As OleDb.OleDbDataReader

'Create the connection object

Dim connection As New OleDb.OleDbConnection(connectionString)

'Create and initialize the command object

Dim command As New OleDb.OleDbCommand("GetDepartments", connection)

command.CommandType = CommandType.StoredProcedure

'Open the connection

connection.Open()

'Return a OleDbDataReader to the calling function

Return command.ExecuteReader(CommandBehavior.CloseConnection)

End Function

Private Shared ReadOnly Property connectionString() As String

Get

Return ConfigurationSettings.AppSettings("ConnectionString")

End Get

End Property

End Class

And the Web.Config connection string :

<configuration>

<appSettings>

<addkey="connectionString"value="Server=(local)\NetSDK; Provider=SQLOLEDB; Integrated Security=SSPI; Initial Catalog=JokePoint"/>

</appSettings>

And the error message :

Cannot open database "JokePoint" requested by the login. The login failed.

Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details:System.Data.OleDb.OleDbException: Cannot open database "JokePoint" requested by the login. The login failed.

Source Error:

Line 16: 'Open the connectionLine 17:Line 18: connection.Open()Line 19: Line 20: 'Return a OleDbDataReader to the calling function

All access accounts and read / write permission are correct.

Any more advise would be much app.

Regards

Mark

Tuesday, March 20, 2012

Connecting to Oracle RDB from SSIS

Hi Gurus,

I am trying to build a Data Warehouse using SSIS in SQL Server 2005. My source data is in Oracle RDB. Now when I am trying to connect to oracle RDB using the OLE DB Source component, I am getting the following error.

Test connection failed because of an error in initializing provider. Oracle client and networking componenets were not found. These components are supplied by Oracle Corporation and part of the Oracle Version 7.3.3 or late client software installtion.

Provider is unable to funtion until these components are installed.

I did install the Oracle RDB client software .Apparently it looks like Microsoft OLE DB for Oracle supports Oracle 7.3.3 and above. At the same time I tried to use ODBC for Oracle RDB driver from ODBC data sources. But the OLE DB Source Component in SSIS can't recognize ODBC. So now I am stuck on how to load the data from Oracle RDB to SQL Server 2005 staging area.

Any thoughts on this would be really appreciated. Ideally we are looking to port the data directly from Oracle RDB to SQL Server without any intermediate flat files (flat files etc)

Thanks,
SK

sk3636 wrote:

Hi Gurus,

I am trying to build a Data Warehouse using SSIS in SQL Server 2005. My source data is in Oracle RDB. Now when I am trying to connect to oracle RDB using the OLE DB Source component, I am getting the following error.

Test connection failed because of an error in initializing provider. Oracle client and networking componenets were not found. These components are supplied by Oracle Corporation and part of the Oracle Version 7.3.3 or late client software installtion.

Provider is unable to funtion until these components are installed.

I did install the Oracle RDB client software .Apparently it looks like Microsoft OLE DB for Oracle supports Oracle 7.3.3 and above. At the same time I tried to use ODBC for Oracle RDB driver from ODBC data sources. But the OLE DB Source Component in SSIS can't recognize ODBC. So now I am stuck on how to load the data from Oracle RDB to SQL Server 2005 staging area.

Any thoughts on this would be really appreciated. Ideally we are looking to port the data directly from Oracle RDB to SQL Server without any intermediate flat files (flat files etc)

Thanks,
SK

I think you should use the ADO.Net connection manager to connect to ODBC sources.

-Jamie

|||

There is an existing post:
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=640502&SiteID=1

which could help you out.
Overall, first, you need to install Oracle client. Second, you need to configure tnsnames.ora file.

Regards,
Yitzhak

|||

Hi,

I was able to make a connection to Oracle RDB using ADO.net. But when I used the ADO.net connection, I am getting the following error for one of the columns in Data Source Reader component.

The phone data type for the external column and Output column is Unicode string [DT_WSTR] and SSIS is not letting me change the data type on the output column. The phone column is defined as varchar in SQL Server 2005.

Error: 0xC020902A at Data Flow Task, DataReader Source [1736]: The "component "DataReader Source" (1736)" failed because truncation occurred, and the truncation row disposition on "output column "PHONE" (2469)" specifies failure on truncation. A truncation error occurred on the specified object of the specified component.

Error: 0xC02090F5 at Data Flow Task, DataReader Source [1736]: The component "DataReader Source" (1736) was unable to process the data.

Error: 0xC0047038 at Data Flow Task, DTS.Pipeline: The PrimeOutput method on component "DataReader Source" (1736) returned error code 0xC02090F5. The component returned a failure code when the pipeline engine called PrimeOutput(). The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing.

Error: 0xC0047021 at Data Flow Task, DTS.Pipeline: Thread "SourceThread0" has exited with error code 0xC0047038.

Error: 0xC0047039 at Data Flow Task, DTS.Pipeline: Thread "WorkThread0" received a shutdown signal and is terminating. The user requested a shutdown, or an error in another thread is causing the pipeline to shutdown.

Error: 0xC0047021 at Data Flow Task, DTS.Pipeline: Thread "WorkThread0" has exited with error code 0xC0047039.

Thanks,
SK

|||

sk3636 wrote:

Hi,

I was able to make a connection to Oracle RDB using ADO.net. But when I used the ADO.net connection, I am getting the following error for one of the columns in Data Source Reader component.

The phone data type for the external column and Output column is Unicode string [DT_WSTR] and SSIS is not letting me change the data type on the output column. The phone column is defined as varchar in SQL Server 2005.

Error: 0xC020902A at Data Flow Task, DataReader Source [1736]: The "component "DataReader Source" (1736)" failed because truncation occurred, and the truncation row disposition on "output column "PHONE" (2469)" specifies failure on truncation. A truncation error occurred on the specified object of the specified component.

Error: 0xC02090F5 at Data Flow Task, DataReader Source [1736]: The component "DataReader Source" (1736) was unable to process the data.

Error: 0xC0047038 at Data Flow Task, DTS.Pipeline: The PrimeOutput method on component "DataReader Source" (1736) returned error code 0xC02090F5. The component returned a failure code when the pipeline engine called PrimeOutput(). The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing.

Error: 0xC0047021 at Data Flow Task, DTS.Pipeline: Thread "SourceThread0" has exited with error code 0xC0047038.

Error: 0xC0047039 at Data Flow Task, DTS.Pipeline: Thread "WorkThread0" received a shutdown signal and is terminating. The user requested a shutdown, or an error in another thread is causing the pipeline to shutdown.

Error: 0xC0047021 at Data Flow Task, DTS.Pipeline: Thread "WorkThread0" has exited with error code 0xC0047039.

Thanks,
SK

So when you said "SSIS is not letting me change the data type on the output column" that's not actually true is it? It HAS let you change it and at execution-time you are now getting these errors.

The error is pretty self explanatory. You are trying to push a value into a column in the pipeline that is not wide enough for it. Hence, you should widen the column.

-Jamie

|||

Hi Jamie,

It HAS let you change it and at execution-time you are now getting these errors.

Not really. I just changed the property in the output column properties and when I say OK, it throws the following error.

Error at Data Flow Task [DataReader Source [4188]]: The data type of output columns on the component "DataReader Source" (4188) cannot be changed.

Error at Data Flow Task [DataReader Source [4188]]: System.Runtime.InteropServices.COMException (0xC020837D)
at Microsoft.SqlServer.Dts.Pipeline.DataReaderSourceAdapter.SetOutputColumnDataTypeProperties(Int32 iOutputID, Int32 iOutputColumnID, DataType eDataType, Int32 iLength, Int32 iPrecision, Int32 iScale, Int32 iCodePage)
at Microsoft.SqlServer.Dts.Pipeline.ManagedComponentHost.HostSetOutputColumnDataTypeProperties(IDTSManagedComponentWrapper90 wrapper, Int32 iOutputID, Int32 iOutputColumnID, DataType eDataType, Int32 iLength, Int32 iPrecision, Int32 iScale, Int32 iCodePage)

Thanks,
SK

|||

sk3636 wrote:

Hi Jamie,

It HAS let you change it and at execution-time you are now getting these errors.

Not really. I just changed the property in the output column properties and when I say OK, it throws the following error.

Error at Data Flow Task [DataReader Source [4188]]: The data type of output columns on the component "DataReader Source" (4188) cannot be changed.

Error at Data Flow Task [DataReader Source [4188]]: System.Runtime.InteropServices.COMException (0xC020837D)
at Microsoft.SqlServer.Dts.Pipeline.DataReaderSourceAdapter.SetOutputColumnDataTypeProperties(Int32 iOutputID, Int32 iOutputColumnID, DataType eDataType, Int32 iLength, Int32 iPrecision, Int32 iScale, Int32 iCodePage)
at Microsoft.SqlServer.Dts.Pipeline.ManagedComponentHost.HostSetOutputColumnDataTypeProperties(IDTSManagedComponentWrapper90 wrapper, Int32 iOutputID, Int32 iOutputColumnID, DataType eDataType, Int32 iLength, Int32 iPrecision, Int32 iScale, Int32 iCodePage)

Thanks,
SK

Oh OK, sorry. In that case you will have to use a Data Conversion component or Derived Column component to convert to the datatype that you wish to convert to.

-Jamie

|||

I did try to use the Data conversion transformation and I got the same error. The error is coming at the output column from the data source reader. So the data flow component didn't traverse upto Data Conversion component to check whether the conversion is taking place or not.

I found similiar threads related to the same issue that I am facing.

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=392224&SiteID=1

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=278744&SiteID=1

SK

|||Have you or anyone else found a resolution for this? I'm experiencing the same problem.

Connecting to Oracle RDB from SSIS

Hi Gurus,

I am trying to build a Data Warehouse using SSIS in SQL Server 2005. My source data is in Oracle RDB. Now when I am trying to connect to oracle RDB using the OLE DB Source component, I am getting the following error.

Test connection failed because of an error in initializing provider. Oracle client and networking componenets were not found. These components are supplied by Oracle Corporation and part of the Oracle Version 7.3.3 or late client software installtion.

Provider is unable to funtion until these components are installed.

I did install the Oracle RDB client software .Apparently it looks like Microsoft OLE DB for Oracle supports Oracle 7.3.3 and above. At the same time I tried to use ODBC for Oracle RDB driver from ODBC data sources. But the OLE DB Source Component in SSIS can't recognize ODBC. So now I am stuck on how to load the data from Oracle RDB to SQL Server 2005 staging area.

Any thoughts on this would be really appreciated. Ideally we are looking to port the data directly from Oracle RDB to SQL Server without any intermediate flat files (flat files etc)

Thanks,
SK

sk3636 wrote:

Hi Gurus,

I am trying to build a Data Warehouse using SSIS in SQL Server 2005. My source data is in Oracle RDB. Now when I am trying to connect to oracle RDB using the OLE DB Source component, I am getting the following error.

Test connection failed because of an error in initializing provider. Oracle client and networking componenets were not found. These components are supplied by Oracle Corporation and part of the Oracle Version 7.3.3 or late client software installtion.

Provider is unable to funtion until these components are installed.

I did install the Oracle RDB client software .Apparently it looks like Microsoft OLE DB for Oracle supports Oracle 7.3.3 and above. At the same time I tried to use ODBC for Oracle RDB driver from ODBC data sources. But the OLE DB Source Component in SSIS can't recognize ODBC. So now I am stuck on how to load the data from Oracle RDB to SQL Server 2005 staging area.

Any thoughts on this would be really appreciated. Ideally we are looking to port the data directly from Oracle RDB to SQL Server without any intermediate flat files (flat files etc)

Thanks,
SK

I think you should use the ADO.Net connection manager to connect to ODBC sources.

-Jamie

|||

There is an existing post:
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=640502&SiteID=1

which could help you out.
Overall, first, you need to install Oracle client. Second, you need to configure tnsnames.ora file.

Regards,
Yitzhak

|||

Hi,

I was able to make a connection to Oracle RDB using ADO.net. But when I used the ADO.net connection, I am getting the following error for one of the columns in Data Source Reader component.

The phone data type for the external column and Output column is Unicode string [DT_WSTR] and SSIS is not letting me change the data type on the output column. The phone column is defined as varchar in SQL Server 2005.

Error: 0xC020902A at Data Flow Task, DataReader Source [1736]: The "component "DataReader Source" (1736)" failed because truncation occurred, and the truncation row disposition on "output column "PHONE" (2469)" specifies failure on truncation. A truncation error occurred on the specified object of the specified component.

Error: 0xC02090F5 at Data Flow Task, DataReader Source [1736]: The component "DataReader Source" (1736) was unable to process the data.

Error: 0xC0047038 at Data Flow Task, DTS.Pipeline: The PrimeOutput method on component "DataReader Source" (1736) returned error code 0xC02090F5. The component returned a failure code when the pipeline engine called PrimeOutput(). The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing.

Error: 0xC0047021 at Data Flow Task, DTS.Pipeline: Thread "SourceThread0" has exited with error code 0xC0047038.

Error: 0xC0047039 at Data Flow Task, DTS.Pipeline: Thread "WorkThread0" received a shutdown signal and is terminating. The user requested a shutdown, or an error in another thread is causing the pipeline to shutdown.

Error: 0xC0047021 at Data Flow Task, DTS.Pipeline: Thread "WorkThread0" has exited with error code 0xC0047039.

Thanks,
SK

|||

sk3636 wrote:

Hi,

I was able to make a connection to Oracle RDB using ADO.net. But when I used the ADO.net connection, I am getting the following error for one of the columns in Data Source Reader component.

The phone data type for the external column and Output column is Unicode string [DT_WSTR] and SSIS is not letting me change the data type on the output column. The phone column is defined as varchar in SQL Server 2005.

Error: 0xC020902A at Data Flow Task, DataReader Source [1736]: The "component "DataReader Source" (1736)" failed because truncation occurred, and the truncation row disposition on "output column "PHONE" (2469)" specifies failure on truncation. A truncation error occurred on the specified object of the specified component.

Error: 0xC02090F5 at Data Flow Task, DataReader Source [1736]: The component "DataReader Source" (1736) was unable to process the data.

Error: 0xC0047038 at Data Flow Task, DTS.Pipeline: The PrimeOutput method on component "DataReader Source" (1736) returned error code 0xC02090F5. The component returned a failure code when the pipeline engine called PrimeOutput(). The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing.

Error: 0xC0047021 at Data Flow Task, DTS.Pipeline: Thread "SourceThread0" has exited with error code 0xC0047038.

Error: 0xC0047039 at Data Flow Task, DTS.Pipeline: Thread "WorkThread0" received a shutdown signal and is terminating. The user requested a shutdown, or an error in another thread is causing the pipeline to shutdown.

Error: 0xC0047021 at Data Flow Task, DTS.Pipeline: Thread "WorkThread0" has exited with error code 0xC0047039.

Thanks,
SK

So when you said "SSIS is not letting me change the data type on the output column" that's not actually true is it? It HAS let you change it and at execution-time you are now getting these errors.

The error is pretty self explanatory. You are trying to push a value into a column in the pipeline that is not wide enough for it. Hence, you should widen the column.

-Jamie

|||

Hi Jamie,

It HAS let you change it and at execution-time you are now getting these errors.

Not really. I just changed the property in the output column properties and when I say OK, it throws the following error.

Error at Data Flow Task [DataReader Source [4188]]: The data type of output columns on the component "DataReader Source" (4188) cannot be changed.

Error at Data Flow Task [DataReader Source [4188]]: System.Runtime.InteropServices.COMException (0xC020837D)
at Microsoft.SqlServer.Dts.Pipeline.DataReaderSourceAdapter.SetOutputColumnDataTypeProperties(Int32 iOutputID, Int32 iOutputColumnID, DataType eDataType, Int32 iLength, Int32 iPrecision, Int32 iScale, Int32 iCodePage)
at Microsoft.SqlServer.Dts.Pipeline.ManagedComponentHost.HostSetOutputColumnDataTypeProperties(IDTSManagedComponentWrapper90 wrapper, Int32 iOutputID, Int32 iOutputColumnID, DataType eDataType, Int32 iLength, Int32 iPrecision, Int32 iScale, Int32 iCodePage)

Thanks,
SK

|||

sk3636 wrote:

Hi Jamie,

It HAS let you change it and at execution-time you are now getting these errors.

Not really. I just changed the property in the output column properties and when I say OK, it throws the following error.

Error at Data Flow Task [DataReader Source [4188]]: The data type of output columns on the component "DataReader Source" (4188) cannot be changed.

Error at Data Flow Task [DataReader Source [4188]]: System.Runtime.InteropServices.COMException (0xC020837D)
at Microsoft.SqlServer.Dts.Pipeline.DataReaderSourceAdapter.SetOutputColumnDataTypeProperties(Int32 iOutputID, Int32 iOutputColumnID, DataType eDataType, Int32 iLength, Int32 iPrecision, Int32 iScale, Int32 iCodePage)
at Microsoft.SqlServer.Dts.Pipeline.ManagedComponentHost.HostSetOutputColumnDataTypeProperties(IDTSManagedComponentWrapper90 wrapper, Int32 iOutputID, Int32 iOutputColumnID, DataType eDataType, Int32 iLength, Int32 iPrecision, Int32 iScale, Int32 iCodePage)

Thanks,
SK

Oh OK, sorry. In that case you will have to use a Data Conversion component or Derived Column component to convert to the datatype that you wish to convert to.

-Jamie

|||

I did try to use the Data conversion transformation and I got the same error. The error is coming at the output column from the data source reader. So the data flow component didn't traverse upto Data Conversion component to check whether the conversion is taking place or not.

I found similiar threads related to the same issue that I am facing.

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=392224&SiteID=1

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=278744&SiteID=1

SK

|||Have you or anyone else found a resolution for this? I'm experiencing the same problem.

Monday, March 19, 2012

Connecting to MDF file over Workgroup

Hi

I've build a client management (Windows) application in VS2005 which works fine on the local development machine but falls over when trying to connect to the SQL Server Express file located on a second machine on the same Workgroup. Several of the apllications will connect to the database file from networked computers.

The error I get when testing the connection or trying to connect via the App is:

-------------------
The file "Z:\BushBreaks.MDF" is on a network path that is not supported for database files.
An attempt to attach and auto-named database for file z:\bushbreaks.mdf failed. A database with the same name exists, or specified file cannot be opened or it is on a UNC share.
-------------------

How can I configure this database and/or connection to be able to allow connections to the MDF file? Please note that security is not an issue if that is at all relevant.

Many Thanks
John

Current you can't use remote database file in your SQL connection. Here is a instruction about AttachDBFileName property in connection string from MSDN:

The name of the primary database file, including the full path name of an attachable database. The path may be absolute or relative by using the DataDirectory substitution string. If DataDirectory is used, the database file must exist within a subdirectory of the directory pointed to by the substitution string.

Note:

Remote server, HTTP, and UNC path names are not supported.

For more information, you can refer to:

http://msdn2.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.connectionstring.aspx

Friday, February 24, 2012

connecting Oracle to SQL 2000?

Hi, i need to build some way of connecting Oracle to SQL Server in order to pull data off Oracle and house it temporarily on SQL 2000 for searching.

Basically we've built an intranet using ASP and SQL 2000 and which also pulls data off Oracle, however our connection to Oracle is very slow so an idea to speed it up would be to have SQL store a temporary snapshot of this data and the ASP site query off the fast connection it has to SQL rather than use our slow connection to Oracle.

This temporary snapshot of Oracle data would be stored on SQL 2000 and updated on a scheduled basis.

Any ideas how to do this, or a better way to work this?

Thing is I tried installing the Official Oracle ODBC & Client software on our SQL 2000 server before and it just took out SQL 2000 so would really like to hear other options.

Thanks in advance,

:confused:I'm not sure why you've had such problems with Oracle and SQL Server. They usually behave like siblings... They fight at first until somebody hauls one or the other "out to the woodshed", then they seem to grudgingly accept each other (although they sometimes still squabble).

Things get a wee bit corn-fused sometimes when you install the Oracle ODBC drivers, because most of them either skirt the rules or violate them outright. Most of those problems are well understood by Oracle users (they have to), and are not usually very hard to work around. The biggest problem I've seen is that no two sets of Oracle drivers seem to misbehave in quite the same way, so you are always fighting a new and different battle with them.

Once I get the Oracle ODBC problems resolved, I'm usually "home free" until the next release. If you are having problems beyond that, I'd like to hear about them... It is almost always good to get new challenges!

-PatP|||I think my problem was i tried to make a Linked Server connection to Oracle directly inside SQL Enterprise Manager connecting via ODBC and that killed the database.

Sunday, February 19, 2012

Connecting from Powerbuilder through ole db, column defaults n

I am using PB 9.0.1 Build 7236. I am using a datawindow to do an Insert.
The column in question should default to zero. It is NOT included as an
updateable column in the datawindow. But PowerBuilder is including it in the
Insert syntax and erroring as the default of zero is not being recognized.
When I use the PB Native MS SQL Server interface, the column default is
recognized. In Enterprise Manager, the default of zero shows on the
in-question column.
I have asked in PB groups but have only got one reply that states that this
is the way the OLE DB interface has always worked. Is this a peculiarity to
OLE DB? Or do you think it is a PB problem?
"Scott Morris" wrote:

> You need to be much more specific. What does "not recognizing column
> defaults" mean? What problems? Are you using datawindows. If so, the only
> time columns are included in insert statements is when your application code
> sets the value of that column. Is that what you are doing? If your code
> (and user) do not provide a value, then it is left out of the inserted
> column "list". In this case, the default is used. You also failed to
> specify which version of Powerbuilder. At the very least, you should review
> the fix list for the most current build of the version you are using to
> determine if there is a bug that has already been fixed.
> Incidentally, you are more likely to get help posting in a powerbuilder NG.
> The more information you post, the more likely someone will help.
> "roz" <roz@.discussions.microsoft.com> wrote in message
> news:091BC8BE-02BE-41AE-8F5C-07621F96BFA5@.microsoft.com...
> problems,
>
>
Sounds to me like your code (or perhaps in an ancestor class) is doing
something unexpected. If the column is not included the the list of
updateable columns, then it will not be included as a column in the insert
list. I've never had a problem with PB in this respect. I suspect that
something else is occurring that is causing the behavior. You may want to
use the preview pane in the dw painter to insert a row (if possible); this
would at least identify PB or your code as the problem. The next step would
be to create a simple test case using the existing datawindow (and without
any of your ancestor/application code). If these succeed, then the problem
lies with the application code. Although I haven't moved beyond PB9 6533, I
suspect that application code or design is the problem. It also may be
related to some odd cirucumstances (sharedata, linkage, get/setfullstate,
etc.). You may also want to investigate whether some piece of code is
dynamically modifying the datawindow and (implicitly or explicitly) setting
the update properties.
Be aware that the default you define in the table and the default you define
within PB are different "things" entirely. PB will not automatically update
a default defined in the datawindow to be consistent with any table-level
default. This should not be an issue in this particular situation.
One last thing: The phrase "... syntax and erroring as the default of zero
is not being recognized" is not particularly meaningful. I will repeat.
Help is much likely to be more "helpful" and more forthcoming if you
accurately and completely describe the problem. By itself, a default (or
lack thereof) will not produce an error when a row is inserted into a table.
Perhaps there is a constraint or trigger that enforces the use of a specific
domain of values for a column, producing the error. It helps to know the
exact text of the error. I'm still not certain what "...the column default
is recognized." means but I'm not certain it matters at this point.
"roz" <roz@.discussions.microsoft.com> wrote in message
news:D6DE6DA2-C749-4546-B121-D097E2C3A25F@.microsoft.com...
> I am using PB 9.0.1 Build 7236. I am using a datawindow to do an Insert.
> The column in question should default to zero. It is NOT included as an
> updateable column in the datawindow. But PowerBuilder is including it in
the
> Insert syntax and erroring as the default of zero is not being recognized.
> When I use the PB Native MS SQL Server interface, the column default is
> recognized. In Enterprise Manager, the default of zero shows on the
> in-question column.
> I have asked in PB groups but have only got one reply that states that
this
> is the way the OLE DB interface has always worked. Is this a peculiarity
to[vbcol=seagreen]
> OLE DB? Or do you think it is a PB problem?
>
> "Scott Morris" wrote:
only[vbcol=seagreen]
code[vbcol=seagreen]
code[vbcol=seagreen]
review[vbcol=seagreen]
NG.[vbcol=seagreen]
2000.[vbcol=seagreen]
out?[vbcol=seagreen]
|||I am trying to do an insert on a table using a datawindow. The dw does not
use the
column 'dues_paid_lifetime' in the select (I searched the source!). Thus
there is no initial value to set to zero. It is not in the select so there
is no column to remove from the update list.. I set the dbparm to
DisableParm = 1. Still on the insert I get the error:
SQLSTATE = 23000
Microsoft OLE DB Provider for SQL Server
Cannot insert the value NULL into column "DUES_PAID_LIFETIME'; column does
not allow nulls. INSERT fails.
The insert syntax also displays in the error message. The column
"DUES_PAID_LIFETIME' is not in the sql syntax.
This does not happen with Oracle or with the Native MSSQL Server interface
sent with Powerbuilder.
Is this a SQLOLEDB bug?
"Scott Morris" wrote:

> Sounds to me like your code (or perhaps in an ancestor class) is doing
> something unexpected. If the column is not included the the list of
> updateable columns, then it will not be included as a column in the insert
> list. I've never had a problem with PB in this respect. I suspect that
> something else is occurring that is causing the behavior. You may want to
> use the preview pane in the dw painter to insert a row (if possible); this
> would at least identify PB or your code as the problem. The next step would
> be to create a simple test case using the existing datawindow (and without
> any of your ancestor/application code). If these succeed, then the problem
> lies with the application code. Although I haven't moved beyond PB9 6533, I
> suspect that application code or design is the problem. It also may be
> related to some odd cirucumstances (sharedata, linkage, get/setfullstate,
> etc.). You may also want to investigate whether some piece of code is
> dynamically modifying the datawindow and (implicitly or explicitly) setting
> the update properties.
> Be aware that the default you define in the table and the default you define
> within PB are different "things" entirely. PB will not automatically update
> a default defined in the datawindow to be consistent with any table-level
> default. This should not be an issue in this particular situation.
> One last thing: The phrase "... syntax and erroring as the default of zero
> is not being recognized" is not particularly meaningful. I will repeat.
> Help is much likely to be more "helpful" and more forthcoming if you
> accurately and completely describe the problem. By itself, a default (or
> lack thereof) will not produce an error when a row is inserted into a table.
> Perhaps there is a constraint or trigger that enforces the use of a specific
> domain of values for a column, producing the error. It helps to know the
> exact text of the error. I'm still not certain what "...the column default
> is recognized." means but I'm not certain it matters at this point.
> "roz" <roz@.discussions.microsoft.com> wrote in message
> news:D6DE6DA2-C749-4546-B121-D097E2C3A25F@.microsoft.com...
> the
> this
> to
> only
> code
> code
> review
> NG.
> 2000.
> out?
>
>
|||It looks to me like there is some other problem. The insert statement
generated by PB does not include the column in the insert list. If this is
true (and you can verify this using profiler - just to be absolutely
certain), then the default constraint you think is present isn't or the
default constraint is not enabled. Another possibility is a mal-functioning
trigger
Based on your information, you should be able to take the insert statement
from the error message, paste it into QA, and generate the error yourself by
executing the statement.
"Roz" <Roz@.discussions.microsoft.com> wrote in message
news:E5F27698-9BC8-4909-919E-63F11B9AF80E@.microsoft.com...
> I am trying to do an insert on a table using a datawindow. The dw does
not
> use the
> column 'dues_paid_lifetime' in the select (I searched the source!). Thus
> there is no initial value to set to zero. It is not in the select so
there[vbcol=seagreen]
> is no column to remove from the update list.. I set the dbparm to
> DisableParm = 1. Still on the insert I get the error:
> SQLSTATE = 23000
> Microsoft OLE DB Provider for SQL Server
> Cannot insert the value NULL into column "DUES_PAID_LIFETIME'; column does
> not allow nulls. INSERT fails.
> The insert syntax also displays in the error message. The column
> "DUES_PAID_LIFETIME' is not in the sql syntax.
> This does not happen with Oracle or with the Native MSSQL Server interface
> sent with Powerbuilder.
> Is this a SQLOLEDB bug?
>
> "Scott Morris" wrote:
insert[vbcol=seagreen]
that[vbcol=seagreen]
to[vbcol=seagreen]
this[vbcol=seagreen]
would[vbcol=seagreen]
without[vbcol=seagreen]
problem[vbcol=seagreen]
6533, I[vbcol=seagreen]
get/setfullstate,[vbcol=seagreen]
setting[vbcol=seagreen]
define[vbcol=seagreen]
update[vbcol=seagreen]
table-level[vbcol=seagreen]
zero[vbcol=seagreen]
table.[vbcol=seagreen]
specific[vbcol=seagreen]
default[vbcol=seagreen]
Insert.[vbcol=seagreen]
an[vbcol=seagreen]
in[vbcol=seagreen]
recognized.[vbcol=seagreen]
is[vbcol=seagreen]
peculiarity[vbcol=seagreen]
column[vbcol=seagreen]
the[vbcol=seagreen]
application[vbcol=seagreen]
inserted[vbcol=seagreen]
to[vbcol=seagreen]
should[vbcol=seagreen]
to[vbcol=seagreen]
powerbuilder[vbcol=seagreen]
me[vbcol=seagreen]

Friday, February 10, 2012

Connect to SQL Server 2000 with VB.NET for Beginners

I just started to learn Visual Basic 2005.NET. I have experience with VBA in Access and SQL Server.

I now want to build applications (client/server) with VB & SQL Server. Does anyone have a simple example with which I can start learning?

Thank you in advance!

There are many samples at the Microsoft download center. They are based either on Access or SQL Server and either on C# or VB.NET.

HTH, Jens Suessmeyer

http://www.sqlserver2005.de
|||

hi

Are your programming a windows based application or an ASP (web based) application?

joey

|||Hi Joey,

not an ASP, just a client/server application.

let's keep it simple. I'm just starting......