New Message on dotNET User Group Hyd

Type Conversion --Urgent

Reply
  Reply to Sender   Recommend Message 1 in Discussion
From: withsreenu

Hi,
i am facing one problem.
Error:
Value of type 'String' cannot be converted to
'System.Data.OleDb.OleDbException'.

here i am sending my code:


Try

Dim myConnection As New OleDbConnection("provider=msdaora.l;user
id=system;password=oracle10;data source=orcl")

myConnection.Open()

Dim myCommand As New OleDbCommand

Dim strSql As String = String.Empty

strSql = "insert into emp(empno,deptno) values (" & Trim(TextBox1.Text) &
"," & Trim(TextBox2.Text) & ")"

myCommand.Connection = myConnection

myCommand.CommandText = strSql

myCommand.ExecuteNonQuery()

MessageBox.Show("Record Inserted")

Catch ex As Exception

'If ex.Message = "ORA-02291: integrity constraint (SYSTEM.EMP_DEPTNO_FK)
violated - parent key not found" Then

'MessageBox.Show("This is not a valid record.")

'End If

Dim oclsException As New clsException

ex = oclsException.RefereceKeyException()

End Try


and i declared one class name as : clsException:
and write one function:

Public Function RefereceKeyException() As OleDb.OleDbException 'Reference
Integrity Exception

Dim ex1 As OleDbException

Return (ex1.Message)

End Function



-->while running the application it gives the following error:

Value of type 'String' cannot be converted to
'System.Data.OleDb.OleDbException'.

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/


View other groups in this category.


Also on MSN:
Start Chatting | Listen to Music | House & Home | Try Online Dating | Daily Horoscopes

To stop getting this e-mail, or change how often it arrives, go to your E-mail Settings.

Need help? If you've forgotten your password, please go to Passport Member Services.
For other questions or feedback, go to our Contact Us page.

If you do not want to receive future e-mail from this MSN group, or if you received this message by mistake, please click the "Remove" link below. On the pre-addressed e-mail message that opens, simply click "Send". Your e-mail address will be deleted from this group's mailing list.
Remove my e-mail address from dotNET User Group Hyd.

Reply via email to