Question Incrementing data

fadedkeil

Member
Joined
Feb 8, 2009
Messages
12
Programming Experience
Beginner
I have this code in my program if i click the generate button
VB.NET:
        con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=D:\proj\Module_1_Encoder\enrollment.mdb"
        con.Open()
        sql = "Select Max(Studnum) from tblStudent"
        da = New OleDb.OleDbDataAdapter(sql, con)
        da.Fill(ds, "tblStudent")
        con.Close()
The Studnum should have a Year(now) and an Incremented value(E.G 2009-001) where 001 is the increment Next value should be 2009-002 when there is 2009-001 in my database Oledb btw its a maskedtextbox i'm stuck help
what line of code should i add next :confused: and i need only to click the generate button once thanks for replies
 
Oh, how i wish you werent using access



SELECT DatePart("yyyy", Now()) & '-' & (Max(studnum) + 1) FROM students


PS; that's a scalar query you have there, not one suitable for filling a datatable
 
thnks vry much but how do i populate the masked textbox with that selected data of studnumber with that query
 
Last edited:

Latest posts

Back
Top