guys... please help me to save, edit and delete files in the data grid...
can you give me the codes so i can do it...
i badly need it for my system...
you'll need SQL queries to achieve these things:
Here is the step-by-step procedure to INSERT a record into an SQL database:
1. Create your VB.NET project.
2. Include the following namespaces.
Imports System.Data 'Required for SQL Imports System.Data.SqlClient 'Required for SQL
The System.Data namespace provides access to classes that represent the ADO.NET architecture while the System.Data.SqlClient namespace is the .NET Framework Data Provider for SQL Server.
3. Declare and instantiate your SQLConnection object and Command object as shown below
Dim con As New SqlConnection Dim cmd As New SqlCommand
4. Pass the SQL connection string to ConnectionString property of your SQLConnection object.
con.ConnectionString = "Data Source=example;Initial Catalog=example;Persist Security Info=True;User ID=admin;Password=admin"
5. Use the Open Method to connect to SQL Server.
6. Set the connection of the command object.
cmd.Connection = con
7. Pass the INSERT SQL statement to the command object commandtext as shown below
cmd.CommandText = "INSERT INTO ExampleTable (field1, [field2, ... ]) VALUES (value1, [value2, ...])"
8. Use the ExecuteNonQuery() method to run the INSERT SQL statement that has no return value.
If you want a return value use ExecuteScalar() instead.
A good example of ExecuteScalar is to get the Identity column after inserting record(ExecuteScalar returns the first column of the first row from the result).
Full sample source code of inserting record to SQL Database:
Dim con As New SqlConnection 'Define variable con as a new SQL Server Connection Dim cmd As New SqlCommand 'Define variable cmd as a new SQL Server Command Try 'Used for Error Logging - Try/Catch con.ConnectionString = "Data Source=examplesource;Initial Catalog=Example;Persist Security Info=True;User ID=admin;Password=admin" 'Sets the properties of the connection string con.Open() 'Invokes the server connection to Open cmd.Connection = con 'The Connection Used for the SQL Command cmd.CommandText = "INSERT INTO ExampleTable([field1], [field2]) VALUES([Value1], [Value2])" 'Sets The Command Text To An Insert Query cmd.ExecuteNonQuery() Catch ex As Exception ' If there's an error, catch it! MsgBox("Error while inserting record on table..." & ex.Message, "Insert Records") 'Displays a Message Box popup to the user notifying them of an error (if any) Finally con.Close() 'Close the SQL connection (Well you wouldn't leave your car door open when you get out of it would you?) End Try
I have two tables, I will call them first-half and second-half (of the year)
Table: first id jan feb mar apr ----------------------- 2 80 90 70 60 3 50 40 60 30 Table: second id jan feb mar apr ----------------------- 2 50 70 60 90 3 80 60 50 ...
i am trying to create a library management system which is supposed to be used to store/keep infp for the library and the library members( book title, author, name and picture for borrower and other stuffs). The app has 6 buttons, delete, save, add,previsous,next, and upload( for upload ...
I want to create a Alternate Coloring in MsFlexGrid that using the Visual Basic Programming.
Here I attach a source code :
MsFlexGrid I give name : Flex
If Wt <= RsParts.Fields!Lowerlimit Then
'*********************************************************** '2. Section for create Color at 1 Column under REMARK Dim lngRow As Long Dim ...