Ik probeer een waarde uit een database in een variable te stoppen:
Wat doe ik fout?
Foutmelding:
heb ook geprobeerd met response.write gelijk na End While te zetten maar dat werkte ook niet...
Wie kan mij helpen?
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
| <%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<%
dim voornaam as string
dim achternaam as string
Dim dbRead as OleDbDataReader
Dim sConnectionString As String
Dim PathInfo as string = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=e:\web\dotnet\test.mdb"
Dim con as OleDbConnection = new OleDbConnection(PathInfo)
Dim SQL as String = "Select * from tblNaam where id =1"
Dim da as OleDbCommand = new OleDBCommand(SQL,Con)
con.open
WHILE dbRead.Read()
voornaam = dbread("voornaam")
achternaam = dbread("achternaam")
End While
%>
Voornaam: <B><%=(voornaam)%></B><BR>
Achternaam: <B><%=(achternaam)%></B>
<%
dbRead.close
Con.close
%> |
Wat doe ik fout?
Foutmelding:
code:
1
| System.NullReferenceException: Object reference not set to an instance of an object. |
heb ook geprobeerd met response.write gelijk na End While te zetten maar dat werkte ook niet...
Wie kan mij helpen?