Simpelt udtræk der fejler - nybegynder
Hej eksperter,Jeg er lige gået i gang med asp.net og har fået bikset dette sammen, men det virker ikke helt...
<%@ Import Namespace="System.Data.OleDb" %>
<script runat="server">
sub Page_Load
dim dbconn,sql,dbcomm
dbconn=New OleDbConnection("Provider=sqloledb; Server=192.168.10.4; Database=Database; uid=brugernavn; pwd=kodeord;Integrated Security=SSPI;Persist Security Info=False;")
dbconn.Open()
sql="SELECT top 10 * FROM KundeTabel"
dbcomm=New OleDbCommand(sql,dbconn)
'Dim reader as SqlDataReader()
Dim dbread as SqlDataReader
bread=dbcomm.ExecuteReader()
Dim strTxt as String
do while dbread.read()
strTxt = "<tr><td>" & reader("name").toString() & "</td>" & _
"<td>" & reader("street").toString() & "</td>" & _
"<td>" & reader("zipcode").toString() & "</td>" & _
"<td>" & reader("city").toString() & "</td>"
loop
lblOutPut.Text = strText
dbread.Close()
dbconn.Close()
end sub
</script>
<html>
<head><title></title></head>
<body>
<table border="1" width="100%">
<tr>
<td>Companyname</td>
<td>Street</td>
<td>Zipcode</td>
<td>City</td>
</tr>
<asp:Label ID="lblOutPut" Runat="server"></asp:Label>
</table>
</body>
</html>
Jeg får følg. fejl:
Compiler Error Message: BC30002: Type 'SqlDataReader' is not defined.
Source Error:
Line 9: dbcomm=New OleDbCommand(sql,dbconn)
Line 10: 'Dim reader as SqlDataReader()
Line 11: Dim dbread as SqlDataReader
Line 12: bread=dbcomm.ExecuteReader()
Line 13: