View Full Version : sp and datarepeater problem

03-29-2007, 05:23 PM
Hi all,

I dont have any errors but I get nothing displayed back. Did I do something wrong here. Thanks.

bkg: I try to create a asp.net page when I can look up a serialnumber using my sql stored produre and list the columns out using repeater control.


<%@ Import Namespace="System.Web.UI.WebControls"%>
<%@ Import Namespace="System.Web.UI.WebControls.Repeater"%>
<%@ Import Namespace="System.Data.SQLclient"%>
<%@ Import Namespace="System.Data"%>
<%@ Import Namespace="System.Data.OleDb" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

Sub SerialLookup(ByVal s As Object, ByVal e As EventArgs)
If Not IsPostBack Then

Dim connSerial As SqlConnection
Dim myDataList As SqlDataReader
connSerial = New SqlConnection

Dim cmd As New SqlCommand("Exec sp_getSerial", connSerial)
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.AddWithValue("@serialNumber", textSerial.Text)
myDataList = cmd.ExecuteReader()
Repeater1.DataSource = myDataList

End If
End Sub

Protected Sub Repeater1_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.RepeaterCommandEventArgs)

End Sub

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>get serial</title>
<link href="report.css" rel="stylesheet" type="text/css"/>


<form id="form1" runat="server">
<asp:TextBox Width="75px" ID='textSerial' runat="server" />&nbsp;&nbsp;
<asp:Button text='Serial' ID='Serial' onClick="SerialLookup" runat="server" />

<asp:Repeater ID="Repeater1" runat="server" OnItemCommand="Repeater1_ItemCommand" >

<%#DataBinder.Eval(Container.DataItem, "t2name1")%>
<%#DataBinder.Eval(Container.DataItem, "t2name2")%>



03-29-2007, 07:53 PM

i already remove 'if not postback' which casue nothing to be displayed but another prob occurs. It keeps saying my SP can not be found and I know I have a good Sql connection (used in another page). Any thoughts?

03-29-2007, 09:30 PM
never mind, found the problem..since I have sp_getserial I dont have to use EXEC.