0

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.

2
Contributors
7
Replies
44
Views
3 Years
Discussion Span
Last Post by sukanya.seluka
0

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
0

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

Edited by Reverend Jim

0

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.

Edited by Reverend Jim

0

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?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.