Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello,
Created an Oracle sequence to give me the next number, however, if i run the command from my Oracle SQL it works fine, but if i run from Excel it adds three to the next number. It keeps jumping by threes? Here's all the code Oracle and Excel. Oracle Sequence: done to create the Oracle sequence, run only 1 time. Create sequence BRP_NextNum start with 9900 increment by 1 nomaxvalue minvalue 9900 nocycle cache 50 noorder Oracle SQL for nextval: Select BRP_NEXTNUM.NEXTVAL FROM DUAL; (this works from My SQL Program!) Excel Code: - this jumps the number by 3 Sheets("Sheet1").Select Dim cnn As New ADODB.Connection Dim rst As New ADODB.Recordset Dim Kolum As Integer 'for entering headers ' Open the connection cnn.Open "Driver={Microsoft ODBC for Oracle};" & _ "Server=****;" & _ "Uid=****;" & _ "Pwd=****;" rst.Open _ "select BRP_NEXTNUM.NEXTVAL FROM DUAL ", _ cnn, adOpenKeyset For Kolum = 0 To rst.Fields.Count - 1 'enter field headers Cells(1, Kolum + 1) = rst.Fields(Kolum).Name Next Cells(2, 1).CopyFromRecordset rst 'dump the result to the sheet 'close the connection rst.Close thanks. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Scroll bar jumps 587 rows Excel 2007 | New Users to Excel | |||
tab key in Excel jumps cursor cells | Excel Worksheet Functions | |||
When I tab in Excel, it jumps from column A to R. Why? | Excel Discussion (Misc queries) | |||
When I doubleclick in Excel, page jumps down/up. | Excel Discussion (Misc queries) | |||
Connect to Oracle using Microsoft ODBC for Oracle | Excel Programming |