Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trouble inserting number field with precision in Oracle 8.1.5 DB

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I am accesing OracleDb 8.1.5 version using ADO objects in VB. I am able to insert, update and delete records in Oracle DB but when the field is number datatype like(number(10,2)) , I m not able to insert into this field . I am using the following code.
Private Sub Command1_Click()
Dim cn As new ADODB.Connection
Dim rs As new ADODB.Recordset
Dim strConnection As String
Dim strSQL As String

cn.CursorLocation = adUseClient
strConnection = "DSN=TEST;UID=scott;PWD=tiger"
cn.Open strConnection
strSQL = "select * from numbertest"
rs.Open strSQL, cn, adOpenKeyset, adLockOptimistic
rs.AddNew
rs!C1 = 101.5
rs.Update
Set rs = Nothing

End Sub

I am using the Microsoft ODBC Driver for Oracle.
It works fine with the Insert command but it fails for above code.

Can anyone help me with this problem..?

It gives the following error .
"[Microsoft][ODBC driver for Oracle][Oracle]ORA-01722: invalid number" error .


 
Have you tried using a SQL INSERT statement?
[tt]
cn.Open strConnection
Set adoCm = new ADODB.Command
adoCm.ActiveConnection = cn

adoCm.CommandText = "INSERT INTO numbertest VALUES (" & lNumber & ")"

adoCm.Execute, , adExecuteNorecords
[/tt]

I'm doing this from memory, so you'll need to check my spelling :)

Chip H.

 
Hi apawaskar ,
Convert the datatype ( i.e from number(10,2) to float ). It will definitely solve ur problem.

raj28
rd2815@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top