Page 1 of 1
Using SQL with VB.Net
Posted: Thu Jun 13, 2013 10:16 pm
by kolega28
So basically I have a textbox with a number in it in a vb project, and I want to be able to store that in a database together with a user number, so like the first user of the app who generates the number will have an entry in the database which will contain the number 1 because they are the first user and the number that was generated, then the second person will have 2 and the number and so on...
I have no clue how to do this, I don't use SQL and need help, any help, preferably help with everything, from how to set up SQL to how to do the databases, just help please.
Re: Using SQL with VB.Net
Posted: Thu Jun 13, 2013 10:24 pm
by benji_19994
Hmm I don't know database hat much but I think #smashapps made a tutorial on our site [url]
http://creativeprogramming.info/2013/04 ... -tutorial/[\url]
Re: Using SQL with VB.Net
Posted: Fri Jun 14, 2013 10:21 am
by Dummy1912
hmm not sure if i get you correct but
you want to generate ID in the sql or you want to generate your own ID and the store it in the sql?
if you want to generate ID you need to use the Primare Key
if you want to generate them yourself you just do
then just do in the button section
Code: Select allmyID = +1 'not tested i write it just now :)
Re: Using SQL with VB.Net
Posted: Fri Jun 14, 2013 11:15 am
by smashapps
Disregard #Dummy1912 idea of incrementing the ID. When you're working with databases in Vb.Net:
(As taken from my own tutorial)
"change AutoIncrementSeed and AutoIncrementStep to 1 from -1. Changing this will mean when you add new records it will increment from 1"
follow the tutorial here:
Click here
We don't use an integer and increase it by one each time we use the properties that vb.net gives us in the design view of the table because then we don't have to worry about it, it automatically increases each time.
If you need more help you can contact me I will be happy to help more.
Re: Using SQL with VB.Net
Posted: Fri Jun 14, 2013 1:39 pm
by noypikami
You should have a primary key, in the first place you should know how to set up the primary key( ( its very important, else your database will fail) . alot of tutorials in you-tube to help you with this database.