creating Auto Number generation in any connection
|
Submitted By:
thava
|
|
Rating:
|
| Views: 6,873 |
Language: Visual Basic |
| Last Modified: October 26, 2008 |
| Instructions: to run this code the connection must support sql Queries and the suto number Field must be an integer data type |
Snippet
public function Generate_No( Table_Name as String, Auto_Field_Name as String) as integer
dim con as new connection
dim rs as new Recordset
' write the codding for connection
'you can use any connection
rs.open("Select Max(" & Auto_Field_Name & ") from " & Table_Name & ""),con
' now it will gives the Biggest number
if not rs.eof then
Generate_No=val(RS(0)) + 1
else
Generate_No=1
end if
End Function
Copy & Paste
|
|
|
Be Social
Reference Sheets
Bye Bye Ads
Monthly Drawing
Top Contributors
Top 10 Kudos This Month
|
What's Here?
- Members: 358,485
- Replies: 966,641
- Topics: 163,457
- Snippets: 4,999
- Tutorials: 1,329
- Total Online: 2,186
- Members: 120
- Guests: 2,066
|