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(ByVal 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=IBMDA400;Data Source=" & source & _
";User ID=myID;Password=myPwd;Default Connection=" & _
Collection
'Create connection object
conn400 = New OleDb.OleDbConnection(conStr400)
'Building SQL select string
Dim selStr As String = "SELECT " & selectedFields & " FROM " & _
table & " WHERE " & field & " = " & keyValue & _
" ORDER BY DSNUMB"
'Create data adapter
da = New OleDb.OleDbDataAdapter(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 4595
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(ByVal 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=IBMDA400;Data Source=" & source & _ ";User ID=myID;Password=myPwd;Default Connection=" & _
Collection 'Create connection object conn400 = New OleDb.OleDbConnection(conStr400)
'Building SQL select string Dim selStr As String = "SELECT " & selectedFields & " FROM " & _ table & " WHERE " & field & " = " & keyValue & _ " ORDER BY DSNUMB"
'Create data adapter da = New OleDb.OleDbDataAdapter(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...
|
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...
|
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...
|
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...
|
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
...
|
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)...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
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...
|
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,...
|
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...
|
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,...
| |