Question:
VB.Net database programming Not any Error but program Not working See Code in Optional?
2009-06-15 04:36:49 UTC
Imports System.Data.OleDb
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim cn As OleDbConnection
Dim cmd As OleDbCommand
Dim dr As OleDbDataReader
Try
cn = New OleDbConnection("Provider Microsoft.Jet.OLEDB.4.0;DataSource=c:\emp.mdb;Jet OLEDB:Database")
cn.Open()
cmd = New OleDbCommand("select * from table1 ", cn)
dr = cmd.ExecuteReader
While dr.Read()
TextBox1.Text = dr(0)
TextBox2.Text = dr(1)
TextBox3.Text = dr(2)
' loading data into TextBoxes by column index
End While
Catch
End Try

End Sub
End Class



i am getting only message not any error that is
" A first chance exception of type 'System.ArgumentException' occurred in System.Data.dll"
Three answers:
?
2009-06-15 08:26:58 UTC
Your code sample doesn't have any statements in the CATCH section.



Place some additional code in the CATCH section to handle displaying the error message. You create an exception object in the catch statement (ex) which will enable you to get some details on the exception. You can display the error message in a message box.



I agree with Colanth - use debug mode to single step through the section of code and see which line throws the exception (error)



Try

your code geos here



Catch ex as exception



messagebox.show(ex.description)



end try
2009-06-15 05:31:43 UTC
That *IS* an error message. (An exception is an error.) Single-step and see what line throws the error.



Also:

Use TextBox1.Text = dr(0).Value, etc.

Put something in your Catch block to handle the errors.
?
2016-11-14 07:56:22 UTC
There must be area between * and from. "pick * from block_master the place block_id=1501 " please have a seem... it must be the explanation. relax ingredient seems to be high-quality... happy coding


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...