473,320 Members | 1,955 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Not the correct result

I am not getting the result that I am expecting in the last statement of the
following code:

Dim dsServer As New DataSet
Dim cmdServer As New SqlCommand
Dim sSelect As String = "SELECT tblServer.DNSName FROM tblServer WHERE
tblServer.ServerID = " & Integer.Parse(Request.QueryString("ID"))
cmdServer.CommandText = sSelect
cmdServer.Connection = SqlConnection1

Dim daServer As New SqlDataAdapter
daServer.SelectCommand = cmdServer
daServer.MissingSchemaAction = MissingSchemaAction.AddWithKey
daServer.Fill(dsServer)
Dim drServer As DataRow
Dim iCurrentRow As Integer
drServer = dsServer.Tables(0).Rows(iCurrentRow)
txtDNSName.Text = drServer("DNSName")

Dim daAppList As New SqlDataAdapter
Dim dsAppList As New DataSet
Dim cmdAppList As New SqlCommand
Dim sSelect2 As String = "SELECT tblApplication.ApplicationID,
tblApplication.Application, tblApplication.RedBookNumber " & _
"FROM tblServer INNER JOIN tblCrossRef ON tblServer.ServerID =
tblCrossRef.ServerID INNER JOIN tblApplication ON tblCrossRef.ApplicationID =
tblApplication.ApplicationID " & _
"WHERE tblServer.ServerID = " & Integer.Parse(Request.QueryString("ID"))
cmdAppList.CommandText = sSelect2
cmdAppList.Connection = SqlConnection1
daAppList.SelectCommand = cmdServer
daAppList.MissingSchemaAction = MissingSchemaAction.AddWithKey
daAppList.Fill(dsAppList)
dgAppList.DataSource = dsAppList
'dgAppList.DataMember = "ApplicationID"
'dgAppList.DataKeyField = "ApplicationID"
dgAppList.DataBind()

The datagrid is returning the results of the first select statement instead
of the second. Any insight into why this is happening?

Nov 19 '05 #1
1 997
Just a guess but I'd say that dsAppList now has 2 tables in it.
dsAppList.Tables(0) is the first result.
dsAppList.Tables(1) is the second.

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"JackO" wrote:
I am not getting the result that I am expecting in the last statement of the
following code:

Dim dsServer As New DataSet
Dim cmdServer As New SqlCommand
Dim sSelect As String = "SELECT tblServer.DNSName FROM tblServer WHERE
tblServer.ServerID = " & Integer.Parse(Request.QueryString("ID"))
cmdServer.CommandText = sSelect
cmdServer.Connection = SqlConnection1

Dim daServer As New SqlDataAdapter
daServer.SelectCommand = cmdServer
daServer.MissingSchemaAction = MissingSchemaAction.AddWithKey
daServer.Fill(dsServer)
Dim drServer As DataRow
Dim iCurrentRow As Integer
drServer = dsServer.Tables(0).Rows(iCurrentRow)
txtDNSName.Text = drServer("DNSName")

Dim daAppList As New SqlDataAdapter
Dim dsAppList As New DataSet
Dim cmdAppList As New SqlCommand
Dim sSelect2 As String = "SELECT tblApplication.ApplicationID,
tblApplication.Application, tblApplication.RedBookNumber " & _
"FROM tblServer INNER JOIN tblCrossRef ON tblServer.ServerID =
tblCrossRef.ServerID INNER JOIN tblApplication ON tblCrossRef.ApplicationID =
tblApplication.ApplicationID " & _
"WHERE tblServer.ServerID = " & Integer.Parse(Request.QueryString("ID"))
cmdAppList.CommandText = sSelect2
cmdAppList.Connection = SqlConnection1
daAppList.SelectCommand = cmdServer
daAppList.MissingSchemaAction = MissingSchemaAction.AddWithKey
daAppList.Fill(dsAppList)
dgAppList.DataSource = dsAppList
'dgAppList.DataMember = "ApplicationID"
'dgAppList.DataKeyField = "ApplicationID"
dgAppList.DataBind()

The datagrid is returning the results of the first select statement instead
of the second. Any insight into why this is happening?

Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: lawrence | last post by:
If I do something like : $result = mysql_query($query); $dbArray = dbResultIntoKeyArray($result); and this is the function: function dbResultIntoKeyArray($result) {
4
by: alisbub | last post by:
1. Write an interactive program that asks the user to input the length and width of a rectangular lawn. The dimensions should be in yards. Your program should compute the area of the lawn in square...
6
by: Garg | last post by:
Everytime I run my code, it shows an error that the input string is not in correct format. Could anybody tell me what is wrong with my line of code? str3 = Integer.Parse(dropBasis3.SelectedIndex...
11
by: jyck91 | last post by:
// Base Conversion // Aim: This program is to convert an inputted number // from base M into base N. Display the converted // number in base N. #include <stdio.h> #include <stdlib.h>...
4
by: banansol | last post by:
I read the thread Floating point rounding error and I saw Richard Heathfield's description with several lines like: 0.1 = 1/2 = 0.5 - too large 0.01 = 1/4 = 0.25 - too large 0.001 = 1/8 = 0.125...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.