我正在尝试创建一个中继器控件,但遇到了一个小问题。以下是中继器控制代码:
<asp:Repeater ID="movies" runat="server">
<ItemTemplate>
<table>
<tr>
<th>
Movie Title: <%# Container.DataItem("MovieTitle")%>
</th>
<th>
Genre: <%# Container.DataItem("Genre")%>
</th>
</tr>
<tr>
<td>
<%# Container.DataItem("Synopsis")%>
</td>
</tr>
<tr>
<td>
Staring: <%# Container.DataItem("Starring")%>
</td>
</tr>
<tr>
<td>
Director: <%# Container.DataItem("Director")%>
</td>
</tr>
</table>
</ItemTemplate>
</asp:Repeater>
控件背后的VB代码是:
movie_title = Request.QueryString("id")
myConn = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source = " & _
Server.MapPath("../App_Data/MovieBoard.accdb"))
myConn.Open()
Dim sqlQuery = "Select movieID From Movies"
Dim aCmd = New OleDbCommand(sqlQuery, myConn)
aDataReader = aCmd.ExecuteReader()
If aDataReader.Read() = True Then
movieID = aDataReader(0)
Else
movieID = "0"
End If
query = ("Select MovieTitle, Genre, Synopsis, Starring, Director From Movies")
cmd = New OleDbCommand(query, myConn)
dr = cmd.ExecuteReader()
movies.DataSource = dr
movies.DataBind()
但是,当我运行代码时,我得到:
Cannot use a leading .. to exit above the top directory.
Line 12: Dim query, movie_title, movieID As String
Line 13: movie_title = Request.QueryString("id")
Line 14: myConn = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source = " & _
Line 15: Server.MapPath("../App_Data/MovieBoard.accdb"))
Line 16: myConn.Open()
我认为问题很小,但我似乎无法找到问题所在。