Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I am using select statement for displaying all of the users in the Categories table of Northwind Database. But in return, nothing is displaying on the page.

 

CAn any one help

 

Regards

Salman Iqbal

 

--------------- Select Statement for Northwind Database --------------

 

<%@ Page Language="vb"%>

<%@ Import Namespace="System.Data.SqlClient" %>

<HTML>

<HEAD>

<title>Dropdown Binding</title>

<script runat="server">

 

Sub Page_load

 

Dim conPubs as SqlConnection

Dim cmdSelect as SqlCommand

Dim dtrAuthors as SqlDataReader

 

conPubs = New SqlConnection("Server=WIN2K3\OMER; UID=sa; PWD=sa; database=Northwind")

conPubs.Open()

cmdSelect = New SqlCommand("Select name from categories", conPubs)

dtrAuthors=cmdSelect.ExecuteReader()

End Sub

 

</script>

 

</HEAD>

<body MS_POSITIONING="GridLayout">

 

<form runat="server" ID="Form1">

 

</form>

 

</body>

</HTML>

 

**********************************

Posted

You were get your result, but where do you want it to display?

 

I will suggest you bind your data to dropdownlist server control.

 

P/S: You can use your "dtrAuthors" DataReader to bind to your dropdownlist server control

Posted

You can also use other server controls like "DataGrid", "Repeater"....

 

Another way is manually form your own HTML table and use "Response.write" to send your source to Client site

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...