I am a very beginner in ASP.NET. I am doing some practice and find the problem as belows. I develop a database file(.mdb) by using Access. But it can't retrieve the data from the database. Actaully, I am using VB as the language, but the errors it show are
about C#. I feel so confused, please help. Source Code: <form runat="server"> </form> <script language="VB" runat=server> Dim Provider = "Provider=Microsoft.Jet.OLEDB.4.0" Dim Database = "Data Source=" & Server.MapPath( "DataBase.mdb" ) Sub Enter_Click(sender
As Object, e As EventArgs) Msg.Text = "" Dim Conn As OleDbConnection, Cmd As OleDbCommand Dim Rd As OleDbDataReader, SQL As String Conn = New OleDbConnection( Provider & ";" & DataBase ) Conn.Open() SQL = "Select * From staff Where ID='" & _ Msg.Text & "'"
Cmd = New OleDbCommand( SQL, Conn ) Rd = Cmd.ExecuteReader() Msg.Text=Rd.Item("CName") Conn.Close() End Sub </script> Source Error: The source code that generated this unhandled exception can only be shown when compiled in debug mode. To enable this, please
follow one of the below steps, then request the URL: 1. Add a "Debug=true" directive at the top of the file that generated the error. Example: or: 2) Add the following section to the configuration file of your application: Note that this second technique will
cause all files within a given application to be compiled in debug mode. The first technique will cause only that particular file to be compiled in debug mode. Important: Running applications in debug mode does incur a memory/performance overhead. You should
make sure that an application has debugging disabled before deploying into production scenario.
First thing, looks like you're missing information in your db connection string. Looks like there are a lot of parameters missing. You can modify/view this connection with the Server Explorer in Visual Studio. First see if you can connect to your test db and
view the data from inside Visual Studio. Once you can successfully do that, then you can debug where your querie breaks down in your VB code. sk
jasonsky
Member
312 Points
184 Posts
Retrieve data from a database
Jan 14, 2004 12:26 PM|LINK
SushilaSB
Star
11417 Points
2265 Posts
Re: Retrieve data from a database
Jan 14, 2004 12:44 PM|LINK
Visual ASP/ASP.NET MVP
http://weblogs.asp.net/sushilasb
sierrakilo
Member
75 Points
15 Posts
Re: Retrieve data from a database
Jan 14, 2004 12:50 PM|LINK