We can reuse this and then we'll say sql this equal to and here uh so create table okay so this is uh the syntax and then the name of the table let's say.
We want to create a table called context okay and then within this um let's say that we want to have a field called person id okay and then after the name.
Of the field you can specify the data type so let's say that the id will be integer and then um we'll have first name last name so let's say first.
Name and then this can be varchar that will be text okay and then i'll show more you know like the types that you can.
Refer to and then here within the brackets you can specify a number of characters that you you know like the limit.
That you can put to it okay like this one and then let's say first name and then comma will be last name and then.
Let's say want to have address as well um maybe city and let's leave it at that for now okay so this will be our uh sql command.
Um and now using the connection we will start to uh execute this command so we'll just reuse this say it's basically when we run this.
Command if connection is open it will open the connection okay so if connection is open then we'll say um theme command.
As new ole db command and then from here we'll specify our sql and then this will be our connections okay so we'll say um sorry this will be our.
- What is Make
- How to Overcome Economic Uncertainty and Focus on What Really Matters
- Some Exciting Updates For Excel For Freelancers Followers
Connection - ID Card Make
Av connection okay and then uh we will execute this command .Uh if you're reading the data we'll use the reader otherwise we'll execute the execute non-query and then after we execute this we'll close out the connection so.
Similarly we can execute other different type of update lineals i'll cover all those examples and then pause this we can say message box.
Maybe completed so let's try and run this earlier we created a ribbon but we didn't add anything so maybe we can add uh.
The ribbon tab f4 i'll just put the name as dbtools or something like that oh sorry um this is the caption or label okay tools and then from tools.
Uh we'll first grab and bring in the groups okay and then let's put a button we'll call the gray table from here um let's call this label as.
Table by the way this ribbon part is not important uh the idea is about working with database okay so i'm gonna bring this up let's.
See if this works okay so here is our ribbon so this is completed so i think it worked okay press f5 and here is a table that we.
Create from there okay um so that is one sample i'm gonna come back here what's this and this is over now.
Um
So now you know how to create a table i'll show you more reference to the data type this is a sample.So for now i'll just comment this out so in this example it has all the major data types an example of uh you know like the field this is a field name and the data type so you can.
Specify for example this is uh the field name and this is the data type and then you can also specify you know like uh the constraint here.
Uh this will be this one is the primary key which is being set up from here okay and then um to the to the specific field you can also specify.
What sort of data it's going to include and then this will be the name of the table which we already covered here so if you need a reference you'll find this.
In the video description um so again all the field names data type uh if you want to set up a set of constraint.
Then you can use this syntax or sql as your reference okay so let's go ahead and create this table to um let's say the table too for this one i.
Hope there's no table there yep um so let's try and run this one i'll press shift f5 here's your table 2 and then if you go to design mode you'll see this is.
Primary key um primary key for auto yeah and then uh this is by it so if you go within it you'll see the.
Field sizes and then the early ones by this is integer law single and so on okay so you'll find all this um money currency.
And then coming down here long text date and time all this okay so that will be pretty much .