Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
5
Reply
increment ID automatically by adding +1
Sulieman Alkatib
Apr 29 2017 7:35 AM
240
Reply
I'm developing a simple application to insert values to ms access database but I need to make event ID as automated field by get maximum value from the column and add +1 to insert the new value
OleDbConnection con = new OleDbConnection(@
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\zoom\Desktop\TRAVIL IN OMAN PROJECT - Copy\WebApplication1\WebApplication1\App_Data\travilinoman.MDB.mdb"
);
con.Open();
OleDbCommand cmd = new OleDbCommand(
"select MAX(ID)+1 from event"
, con);
OleDbDataReader dr = cmd.ExecuteReader();
TextBox
1
.Text = dr.ToString();
con.Close();
the textboxis showing this result : System.Data.OleDb.OleDbDataReader
how can I convertit to the acctual value (int) ???
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
5
)
Next Recommended Forum
asp.net registration form solution
Feeling awkward !!!!!!!!!!!