Hello all,
I'm developing a web application using VB.Net 2003 and Framework 1.1. This
application queries an AS/400 database. I'm using the IBM OleDb provider
that came with IBM Client Access for Windows (V5R3). Everything works fine
on my development PC, but when I move the application to a Windows Server
2003, it crashes when trying to fill a dataset. I've double-checked that the
Win 2k3 server does have Client Access installed, that it has .NET Framework
1.1, and running IIS. The only difference between my development PC and the
2k3 Server is that my PC is running WinXP Pro (thus it runs IIS v.5.1) while
the server is running IIS v.6.0.
Here is my code:
Public Sub LoadDataSet(ByV al source As String, ByVal Collection As String, _
ByVal table As String, ByVal field As String, ByVal keyValue As
String)
'Connection string to as400 database
conStr400 = "Provider=IBMDA 400;Data Source=" & source & _
";User ID=myID;Passwor d=myPwd;Default Connection=" & _
Collection
'Create connection object
conn400 = New OleDb.OleDbConn ection(conStr40 0)
'Building SQL select string
Dim selStr As String = "SELECT " & selectedFields & " FROM " & _
table & " WHERE " & field & " = " & keyValue & _
" ORDER BY DSNUMB"
'Create data adapter
da = New OleDb.OleDbData Adapter(selStr, conn400)
Dim count As Integer = 0
'Open connection to database.
'The Response.Write statements are for debugging purpose only
Response.Write( "Conn State before open: " & conn400.State & "<br>")
'shows "0"
conn400.Open()
Response.Write( "Conn State after open: " & conn400.State & "<br>")
'>>> shows "1": connected
'Try to load dataset
Try
ds.Clear()
Response.Write( "Before Fill: " & ds.Tables.Count & "<br>")
'>>> shows "Before Fill: 0" : ds was created, just doesn't have any data,
yet.
count = da.Fill(ds) <<<<<<<< Null Exception occurs here
Response.Write( "After Fill: " & ds.Tables.Count & _
"<br>Rec count = " & count) <----- Doesn't show
anything
Catch ex As Exception
TextBox2.Text = "Fill Error: " & ex.Message
'>>>shows "Object reference not set to an instance of the object."
Finally
conn400.Close()
Response.Write( "Conn State after close: " & conn400.State)
'>>> Shows "Finally: 0" : disconnected
End Try
End Sub
At the line of code where that causes exception, the only objects referred
are the Data Adapter "da" and the DataSet "ds".
The dataset "ds" is not the problem because I can count the number of tables
in it before the fill. So the thing that got left is the data adapter.
Why isn't it created/instanitiated?
Please help... I'm stuck with this for the last 3 days I still can't figure
out the cause/solution for it.
Thank you very much.
Stanav. 3 4607
Stanav wrote: Hello all, I'm developing a web application using VB.Net 2003 and Framework 1.1. This application queries an AS/400 database. I'm using the IBM OleDb provider that came with IBM Client Access for Windows (V5R3). Everything works fine on my development PC, but when I move the application to a Windows Server 2003, it crashes when trying to fill a dataset. I've double-checked that the Win 2k3 server does have Client Access installed, that it has .NET Framework 1.1, and running IIS. The only difference between my development PC and the 2k3 Server is that my PC is running WinXP Pro (thus it runs IIS v.5.1) while the server is running IIS v.6.0. Here is my code:
Public Sub LoadDataSet(ByV al source As String, ByVal Collection As String, _ ByVal table As String, ByVal field As String, ByVal keyValue As String)
'Connection string to as400 database conStr400 = "Provider=IBMDA 400;Data Source=" & source & _ ";User ID=myID;Passwor d=myPwd;Default Connection=" & _
Collection 'Create connection object conn400 = New OleDb.OleDbConn ection(conStr40 0)
'Building SQL select string Dim selStr As String = "SELECT " & selectedFields & " FROM " & _ table & " WHERE " & field & " = " & keyValue & _ " ORDER BY DSNUMB"
'Create data adapter da = New OleDb.OleDbData Adapter(selStr, conn400)
Dim count As Integer = 0
'Open connection to database. 'The Response.Write statements are for debugging purpose only
Response.Write( "Conn State before open: " & conn400.State & "<br>") 'shows "0"
conn400.Open()
Response.Write( "Conn State after open: " & conn400.State & "<br>") '>>> shows "1": connected
'Try to load dataset Try ds.Clear()
Response.Write( "Before Fill: " & ds.Tables.Count & "<br>") '>>> shows "Before Fill: 0" : ds was created, just doesn't have any data, yet.
count = da.Fill(ds) <<<<<<<< Null Exception occurs here
Response.Write( "After Fill: " & ds.Tables.Count & _ "<br>Rec count = " & count) <----- Doesn't show anything
Catch ex As Exception
TextBox2.Text = "Fill Error: " & ex.Message '>>>shows "Object reference not set to an instance of the object."
Finally conn400.Close() Response.Write( "Conn State after close: " & conn400.State) '>>> Shows "Finally: 0" : disconnected End Try End Sub
At the line of code where that causes exception, the only objects referred are the Data Adapter "da" and the DataSet "ds". The dataset "ds" is not the problem because I can count the number of tables in it before the fill. So the thing that got left is the data adapter. Why isn't it created/instanitiated? Please help... I'm stuck with this for the last 3 days I still can't figure out the cause/solution for it. Thank you very much. Stanav.
Are you quering the same data on your machine and the server? My gut
says that it is a problem in the data that is being retrieved and not in
the da or ds objects.
Chris
Thanks for replying to my post, Chris.
And yes, I'm quering the same data on both machines.
I'm still stuck on this... Any other suggestions/ideas?
Stanav,
My idea says me that you are getting the data with two different users.
Can that not be the problem?
(Although you have your connection to the database, can the database maybe
be restricted)
Just a guess
Cor This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: IMRAN SAROIA |
last post by:
Hi!
I want to select specific row from Database in Select
Query. Can any one adivse?
E.g., in selection criteria I want to mention row to retrieve.
Are there any alternatives. I donot want to use postion property.
I want to fill Dataset with just one row at a time.
Please adivse!
|
by: Adam Clauss |
last post by:
This may be more of a Visual Studio question than a C# question, but it came
up within the context of a C# app, so here it is.
In a Windows Form or a Web Form application, you can drag various
DataAdapters and create DataSets bound to them so everything is strongly
typed - a very nice feature.
Why in the world can this not be done the...
|
by: PawelR |
last post by:
Hello everybody,
I have one littel question:
How fill DataSet values witch return stored procedure?
My SP have parameters.
Thanks
PawelR
|
by: Rich |
last post by:
Hi,
I've done a drag and drop of a sqlDataAdapter and generated a dataset on a
second WinForm (Form2) I'm opening as a dialog box. I can bind to it and
retrieve results but I get an error when I try to use any
BindingContext.Count/Position methods on the dataset. Any help greatly
appreciated.
Error: 'Cannot create a child list for field...
|
by: Nikolay Petrov |
last post by:
How to fill DataSet from stored procedure?
| |
by: Nikolay Petrov |
last post by:
How to fill dataset with multiple tables and set their relaition?
Can I get the relations from the SQL server?
Also I would like to do it using stored procedures.
TIA
|
by: Yoel Mc Lennan |
last post by:
Hello Group, I need to obtain recordset of an object COM made in VB6 and
soon fill dataset, some idea of where is the error? Thanks.
Imports System.Data
Imports System.Configuration
Public Class WebForm1
Inherits System.Web.UI.Page
Dim o_interlab As INTERLAB.CLaboratorio
|
by: Laura K |
last post by:
This is probably a simple question but I want to make sure I am doing
it right.
I have a spoc with two select statements which results in two tables.
Very Basic
---------------------------------------------------------------------------------
@strProductCode nvarchar (50)
|
by: Newbie |
last post by:
Hi,
I have a dataadapter that contains just a single record.
Dim SqlDataAdapterValues As New SqlDataAdapter("select * from
tbl_formatvalue where format_id = " & intFormatInt, dbConnectionIn)
SqlDataAdapterJobs.Fill(dsFormats, "formatvalues")
I want to get the value for column customer_id from this dataset.
|
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...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
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...
|
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...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |