Hi,
I am currently in the process of teaching myself VB.net. My first challenge was to write as program that stores order info. The app must use a centralised database and me able to run from several terminals at once. So I thought I would skip the wizard and use manual commands to connect to the database, this way I could incorporate a settings menu that could enable the user to select the path to the database and work the path into some code. Sadly I have been blackballed and I am stuck. I can only find limited info on manual database connection commands and tried using SQL commands. I would appreciated any help on what I am doing wrong and please keep in mind that I am very very new to VB.
Here is the section of my code relating to my problems:
Please Note: All variables were declared.
I am currently in the process of teaching myself VB.net. My first challenge was to write as program that stores order info. The app must use a centralised database and me able to run from several terminals at once. So I thought I would skip the wizard and use manual commands to connect to the database, this way I could incorporate a settings menu that could enable the user to select the path to the database and work the path into some code. Sadly I have been blackballed and I am stuck. I can only find limited info on manual database connection commands and tried using SQL commands. I would appreciated any help on what I am doing wrong and please keep in mind that I am very very new to VB.
Here is the section of my code relating to my problems:
Please Note: All variables were declared.
VB.NET:
[COLOR=#000000][FONT=Consolas]Dim sqlConnection1 AsNew System.Data.SqlClient.SqlConnection("Provider=Microsoft.ACE.OLEDB.12.0;DataSource=|DataDirectory|\My Project\Special Order Database.accdb")[/FONT]
[FONT=Consolas]Dim cmd As New System.Data.SqlClient.SqlCommand[/FONT]
[FONT=Consolas] cmd.CommandType = System.Data.CommandType.Text[/FONT]
[FONT=Consolas]Dim order_ref As Integer = 1000[/FONT]
[FONT=Consolas]Dim columns As String = "Order Reference,Customer Name, Contact Number, Part Requested, Supplier, Date Ordered, DepositAmount, Deposit Method, Part Ordered, Order Status, Order Notes"[/FONT]
[FONT=Consolas]Dim values As String = order_ref + "," + customer_name + ", " +contact_number + ", " + item_requested + "," + supplier + ", " +order_date + ", " + deposit + "," + deposit_method + ", " +part_ordered_yet + ", " + order_status + "," + order_notes[/FONT]
[FONT=Consolas] cmd.CommandText = "INSERT INTO Special Order (" + columns + ")VALUES (" + values + ");"[/FONT]
[FONT=Consolas] cmd.Connection = sqlConnection1[/FONT]
[FONT=Consolas] sqlConnection1.Open()[/FONT]
[FONT=Consolas] cmd.ExecuteNonQuery()[/FONT]
[FONT=Consolas] sqlConnection1.Close()[/FONT]
[/COLOR]