i have a serial id, and i should fix that only 100 entries are allowed.How can i do this by code? and also how can i automatically generate consecutive numbers i.e from 1 to 100.Please help me frnds.I have to complete my project soon.

Recommended Answers

You haven't given us much to go on. I assume this application involves a database. If so you haven't said what type. Typically, if you want to get the next available value in a field you use the MAX function, then add one. Also, you'll have to get the number …

Jump to Post

You can connect to the Oracle database using OLEDB and execute the queries against the Oracle database. Do you know how to use OLEDB?

Jump to Post

All 7 Replies

You haven't given us much to go on. I assume this application involves a database. If so you haven't said what type. Typically, if you want to get the next available value in a field you use the MAX function, then add one. Also, you'll have to get the number of entries already in the database because you have a limit of 100. To get the number of entries you can do

SELECT COUNT(*) FROM myTable

Once you have verified that you have space for another entry you can generate the next serialID by

SELECT MAX(serialID)+1 AS nextID FROM myTable

no no, this is to b done in vb6.0.,
besides i m having oracle db connection.,

You can connect to the Oracle database using OLEDB and execute the queries against the Oracle database. Do you know how to use OLEDB?

no i dont know but i m using adodc cntrl in ma prjct.,

I can't say specifically for ADODC but using ADODB it looks like this

Dim con As New ADODB.Connection
Dim rec As New ADODB.Recordset

con.Open("Driver={SQL Server};Server=.\SQLEXPRESS;Database=PUBS;Trusted_Connection=yes;")

rec.Open("SELECT COUNT(*) FROM authors", con, CursorTypeEnum.adOpenStatic)
MsgBox("NUMBER OF RECORDS = " & rec(0).Value)
rec.Close()

con.Close()

Note that this uses a connection string for SQLEXPRESS. You would have to change that to the connection string for Oracle. I don't have Oracle installed so I cannot test this.

tanQ.,
bt it wil b btr if i got how to do d same in adodc?

i m dng admission project 4 my college.any no of data might b added any time.i want to know how many entries are done in particular date, how v can do this in oracle database?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.