Hi Guys,
I have been using VB.NET for quite a few years and am comfortable with general programming and winforms. The area where I don't have too much info is database.
I am creating a small application which can store information about movies on a computer. It can store information about a movie, cast etc. To make this program I created a SQL Server Compact Edition database and added a few tables and columns for each tables.
For example assume the following:
Database Name: Movie
Table 1: Info
Cols: ID, NameofMovie, Date, Genre, Plot ...
Table 2: Cast
Cols: ID, FirstName, LastName, Dob ...
I am familiar with structure arrays we use in our code. We create them, can store info & any item can be edited or deleted. Here I have not yet created any structure. My queries :
1) Do I need to create a structure which is identical to database table fields. Or can I create a temp variable which points to them to store temporary information.
2) How can I edit a particular record in a table ? Is sql only option or ?
3) Right now I load database from file using code (see below). To store temp info what do I do if I am not using structure.
You see since I am not using structures and txt files, I need help editing, saving content to database and guidance on how to store temporary information. If I need create a structure identical to database table fields then let me know.
I will be glad if anyone can help me.
Thanks a lot,
Cheers,
GR
I have been using VB.NET for quite a few years and am comfortable with general programming and winforms. The area where I don't have too much info is database.
I am creating a small application which can store information about movies on a computer. It can store information about a movie, cast etc. To make this program I created a SQL Server Compact Edition database and added a few tables and columns for each tables.
For example assume the following:
Database Name: Movie
Table 1: Info
Cols: ID, NameofMovie, Date, Genre, Plot ...
Table 2: Cast
Cols: ID, FirstName, LastName, Dob ...
I am familiar with structure arrays we use in our code. We create them, can store info & any item can be edited or deleted. Here I have not yet created any structure. My queries :
1) Do I need to create a structure which is identical to database table fields. Or can I create a temp variable which points to them to store temporary information.
2) How can I edit a particular record in a table ? Is sql only option or ?
3) Right now I load database from file using code (see below). To store temp info what do I do if I am not using structure.
Code:
Dim connectString As String = "DataSource=MovieDB.sdf;"
Dim cn As New SqlCeConnection(connectString), sql As String = "SELECT * from movie"
If cn.State = ConnectionState.Closed Then
cn.Open()
End If
Dim cmd As New SqlCeCommand(sql, cn) : cmd.CommandType = CommandType.Text
Dim SqlData As New SqlCeDataAdapter(sql, cn)
MovieDataset = New DataSet
SqlData.SelectCommand = cmd
SqlData.Fill(MovieDataset, "Movie")
SqlData.SelectCommand.CommandText = "Select * from [Cast]"
SqlData.Fill(MovieDataset, "Cast")
cn.close
I will be glad if anyone can help me.
Thanks a lot,
Cheers,
GR