469,934 Members | 2,657 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,934 developers. It's quick & easy.

Getting a DNS error, can someone help - please?

Below is my code for dropdownlist that is populated from a SQL table.
After a selection from the ddl, a datagrid is suppose to come up
pertaining to the information selected, but I keep getting a DNS
error. I developed this "simple" page but so far it is not simple!
argh!

<%@ Page Language="VB" Debug="true" Explicit="true" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.SQLClient" %>
<script runat="server">

Dim strConn as string =
"server=abcdserver;database=acct_payable;trusted_c onnection=true"

Sub Page_Load(Source as Object, E as EventArgs)
if not Page.IsPostBack then
doData()
end if
End Sub


Sub doQuery(Source as Object, E as EventArgs)
'Sub doQuery is for the datagrid
'This may be the source of DSN errors - the sql statement
Dim supname as string
Dim MySQL = "SELECT splr_name, splr_name, splr_addr, " & _
"splr_city FROM tbl_ap_vendors WHERE splr_name='" & supname &
"'"
Dim MyConn as New SQLConnection(strConn)
Dim ds as DataSet=New DataSet()
Dim Cmd as New SQLDataAdapter(MySQL,MyConn)
Cmd.Fill(ds,"tbl_ap_vendors")

'MyDataGrid is for the datagrid to fill
MyDataGrid.Datasource=ds.Tables("tbl_ap_vendors"). DefaultView
MyDataGrid.DataBind()
End Sub
Sub doData()
'Sub doData is for the dropdownlist
Dim strSQL =
"server=abcdserver;database=acct_payable;trusted_c onnection=true"

Dim Conn as new SQLconnection(strConn)
strSQL = "select splr_name from tbl_ap_vendors ORDER BY
splr_name"
Dim Cmd as New SQLCommand(strSQL,Conn)
Conn.Open()
MyDropDownList.DataSource = Cmd.ExecuteReader()
MyDropDownList.DataBind()
End Sub
Function FixDR (sItem) as String
'Function FixDR is for null fields
if Not sItem is System.DBNull.Value then FixDR=sItem
End Function

</script>
<html>
<head>

<title>Testing a dropdownlist and datagrid</title>
</head>
<body>
<Form id="form1" runat="server">
<div align="center"><table> <tr>

</tr>
<tr>
<!-- HTML code to display the DropDownList on the screen for user
input
list is populated by a SQL table and selection bring up DataGrid -->
<td align="center" valign="Top" Colspan="2"><hr>
<b><i><font Color="#0000FF">Using a DropDownList and a
DataGrid:</font></i></b>
<asp:DropDownList id="MyDropDownList" datatextfield="splr_name"
runat="server" />
<asp:Button id="button" Text="Select Supplier Name" onClick="doQuery"
runat="server" />
<!-- HTML code to display the DataGrid on the screen selection is
determined from user
input selection from DropDownList -->
<asp:Datagrid
Id="MyDataGrid"
Width="700"
BackColor="#ccccff"
BorderColor="black"
ShowFooter="false"
CellPadding=3
CellSpacing="0"
Font-Name="Verdana"
Font-Size="8pt"
HeaderStyle-BackColor="#aaaadd"
EnableViewState="false">
</asp:DataGrid>
</td>
</tr>
</table></div>
</Form>

</body>
</html>
Nov 18 '05 #1
6 1560
....and the error is? And the line of code it points to is?

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Teep" <ti********@nav-international.com> wrote in message
news:e5**************************@posting.google.c om...
Below is my code for dropdownlist that is populated from a SQL table.
After a selection from the ddl, a datagrid is suppose to come up
pertaining to the information selected, but I keep getting a DNS
error. I developed this "simple" page but so far it is not simple!
argh!

<%@ Page Language="VB" Debug="true" Explicit="true" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.SQLClient" %>
<script runat="server">

Dim strConn as string =
"server=abcdserver;database=acct_payable;trusted_c onnection=true"

Sub Page_Load(Source as Object, E as EventArgs)
if not Page.IsPostBack then
doData()
end if
End Sub


Sub doQuery(Source as Object, E as EventArgs)
'Sub doQuery is for the datagrid
'This may be the source of DSN errors - the sql statement
Dim supname as string
Dim MySQL = "SELECT splr_name, splr_name, splr_addr, " & _
"splr_city FROM tbl_ap_vendors WHERE splr_name='" & supname &
"'"
Dim MyConn as New SQLConnection(strConn)
Dim ds as DataSet=New DataSet()
Dim Cmd as New SQLDataAdapter(MySQL,MyConn)
Cmd.Fill(ds,"tbl_ap_vendors")

'MyDataGrid is for the datagrid to fill
MyDataGrid.Datasource=ds.Tables("tbl_ap_vendors"). DefaultView
MyDataGrid.DataBind()
End Sub
Sub doData()
'Sub doData is for the dropdownlist
Dim strSQL =
"server=abcdserver;database=acct_payable;trusted_c onnection=true"

Dim Conn as new SQLconnection(strConn)
strSQL = "select splr_name from tbl_ap_vendors ORDER BY
splr_name"
Dim Cmd as New SQLCommand(strSQL,Conn)
Conn.Open()
MyDropDownList.DataSource = Cmd.ExecuteReader()
MyDropDownList.DataBind()
End Sub
Function FixDR (sItem) as String
'Function FixDR is for null fields
if Not sItem is System.DBNull.Value then FixDR=sItem
End Function

</script>
<html>
<head>

<title>Testing a dropdownlist and datagrid</title>
</head>
<body>
<Form id="form1" runat="server">
<div align="center"><table> <tr>

</tr>
<tr>
<!-- HTML code to display the DropDownList on the screen for user
input
list is populated by a SQL table and selection bring up DataGrid -->
<td align="center" valign="Top" Colspan="2"><hr>
<b><i><font Color="#0000FF">Using a DropDownList and a
DataGrid:</font></i></b>
<asp:DropDownList id="MyDropDownList" datatextfield="splr_name"
runat="server" />
<asp:Button id="button" Text="Select Supplier Name" onClick="doQuery"
runat="server" />
<!-- HTML code to display the DataGrid on the screen selection is
determined from user
input selection from DropDownList -->
<asp:Datagrid
Id="MyDataGrid"
Width="700"
BackColor="#ccccff"
BorderColor="black"
ShowFooter="false"
CellPadding=3
CellSpacing="0"
Font-Name="Verdana"
Font-Size="8pt"
HeaderStyle-BackColor="#aaaadd"
EnableViewState="false">
</asp:DataGrid>
</td>
</tr>
</table></div>
</Form>

</body>
</html>

Nov 18 '05 #2
Thanks for looking at my post.

The SubdoQuery may be the source of the error - I posted that in my
code. The program runs the first half the ddl, and after the button is
clicked a generic DNS error page comes up - "the page cannot be
displayed."

Actually, on the bottom of the page it says: "Cannot find server or DNS
Error." No other error code, like 400s or 500s.
*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #3
That error code indicates that the web server specified in your URL does not
exist (for example, if you mis-typed "http://microsoft.com" as
"http://micorsoft.com", or that a DNS error has occurred which prevents the
browser from being able to resolve the IP address of the server. What does
the URL for the page look like in the address bar of your browser?

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"TN Bella" <ti********@nav-international.com> wrote in message
news:Od**************@tk2msftngp13.phx.gbl...
Thanks for looking at my post.

The SubdoQuery may be the source of the error - I posted that in my
code. The program runs the first half the ddl, and after the button is
clicked a generic DNS error page comes up - "the page cannot be
displayed."

Actually, on the bottom of the page it says: "Cannot find server or DNS
Error." No other error code, like 400s or 500s.
*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 18 '05 #4
Thanks for your help!
It says the same thing when the page loads and after the button is
clicked: http://localhost:8080/testingpage4.aspx
*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #5
Does your machine have a hosts entry for "localhost?" Try manually typing in
the URL in your browser, and substitute the machine name (or 127.0.0.1) for
"localhost" and see if you get the same error. What development environment
are you using?

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"TN Bella" <ti********@nav-international.com> wrote in message
news:uD**************@tk2msftngp13.phx.gbl...
Thanks for your help!
It says the same thing when the page loads and after the button is
clicked: http://localhost:8080/testingpage4.aspx
*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 18 '05 #6


Thanks for your help. My error is now fixed, I just retyped the code
again and boom it worked! I appreciate all your time and patience with
this situation.

Tina

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Tim::.. | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.