VB.net - load data from SQL database format datagridview and use statement with
🎁🎁Full course VB.net with MySQL database(Insert, Update, Delete, and Search)🎉🎉 with code
https://youtube.com/clip/UgkxaESVafvSL8Sjake6z1v2gUA9vA1Xe-gk
Fill dataGridview from Excel's sheet depend on comBobox in C# with source code
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.OleDb;
namespace excel_import
{
public partial class Form6 : Form
{
public Form6()
{
InitializeComponent();
}
OleDbConnection conn = new OleDbConnection("Provider=Microsoft.Ace.Oledb.12.0;" +
@"Data Source=F:names2.Xlsx;Extended Properties = 'Excel 8.0;HDR=Yes'");
private void Form6_Load(object sender, EventArgs e)
{
conn.Open();
comboBox1.DataSource = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
comboBox1.DisplayMember = "Table_Name";
comboBox1.SelectedIndex = -1;
comboBox1.SelectedText = "Select sheet";
conn.Close();
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void comboBox1_SelectionChangeCommitted(object sender, EventArgs e)
{
OleDbCommand cmd = new OleDbCommand("Select * From [" + comboBox1.GetItemText(comboBox1.SelectedItem) + "]", conn);
OleDbDataAdapter da = new OleDbDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
dataGridView1.DataSource = dt;
}
}
}
Programming in VB.net: How to Make system backup databases in SQL server
With source code Excel macro VBA tutorial| insert update delete in sheet excel using entry form
Private Sub CommandButton1_Click()
Dim sheet_v As Worksheet
Set sheet_v = ThisWorkbook.Sheets("sheet1")
Dim lrow_v As Long
lrow_v = Sheets("sheet1").Range("A" & Rows.Count).End(xlUp).Row
sheet_v.Range("A" & lrow_v + 1).Value = TextBox1.Value
sheet_v.Range("B" & lrow_v + 1).Value = TextBox2.Value
sheet_v.Range("C" & lrow_v + 1).Value = TextBox3.Value
sheet_v.Range("D" & lrow_v + 1).Value = TextBox4.Value
TextBox1.Value = ""
TextBox2.Value = ""
TextBox3.Value = ""
TextBox4.Value = ""
'MsgBox ("Data inserted successfully")
Call load_data
End Sub
Sub load_data()
Dim sheet_v As Worksheet
Set sheet_v = ThisWorkbook.Sheets("sheet1")
Dim lrow_v As Long
lrow_v = Sheets("sheet1").Range("A" & Rows.Count).End(xlUp).Row
sheet_v.Range("A" & lrow_v + 1).Value = TextBox1.Value
With ListBox1
.ColumnCount = 4
.ColumnHeads = True
.ColumnWidths = "70,90,90,90"
.RowSource = "sheet1!A2:D" & lrow_v
End With
End Sub
Private Sub CommandButton2_Click()
Dim lrow_v As Long
lrow_v = Sheets("sheet1").Range("A" & Rows.Count).End(xlUp).Row
Dim i As Long
For i = 2 To lrow_v
If Sheets("sheet1").Cells(i, 1).Value = id.Text Then
Sheets("sheet1").Cells(i, 1).Value = TextBox1.Text
Sheets("sheet1").Cells(i, 2).Value = TextBox2.Text
Sheets("sheet1").Cells(i, 3).Value = TextBox3.Text
Sheets("sheet1").Cells(i, 4).Value = TextBox4.Text
End If
Next i
End Sub
Private Sub CommandButton3_Click()
Dim lrow_v As Long
lrow_v = Sheets("sheet1").Range("A" & Rows.Count).End(xlUp).Row
Dim i As Long
For i = 2 To lrow_v
If Sheets("sheet1").Cells(i, 1).Value = id.Text Then
Rows(i).Delete
End If
Next i
TextBox1.Value = ""
TextBox2.Value = ""
TextBox3.Value = ""
TextBox4.Value = ""
id.Value = ""
End Sub
Private Sub ListBox1_Click()
End Sub
Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
TextBox1.Value = ListBox1.Column(0)
TextBox2.Value = ListBox1.Column(1)
TextBox3.Value = ListBox1.Column(2)
TextBox4.Value = ListBox1.Column(3)
id.Value = ListBox1.Column(0)
End Sub
Private Sub UserForm_Click()
End Sub
Private Sub UserForm_Initialize()
Call load_data
End Sub
Important videos c#
Programming C# : Connect SQL server database with Visual Studio C# with source code
c# tutorial for beginners - insert update delete search in sql server database and print (With code)
Programming C#: insert, update and delete data in datagridview without using database
C#: update all data from datagridview to database at once
c# tutorial for beginners: How to store images update and delete in sql database
https://youtu.be/AwvrH8QK7DM
C# Tutorial : Retrieve data from Sql server database
https://youtu.be/lR_Ic_u8e90
C# Tutorial import data from Excel to SQL server
c# tutorial for beginners: Add Row Total To DataGridView Footer
c# tutorial for beginners: Insert Only Checked rows from datagridview into SQL database
C#: Get data in datagridview from two tables using inner join and (Left - right - full) outer join.
c# tutorial for beginners: Send data from datagridview to crystalreport without database in C#
c# tutorial for beginners: Print data from dataGridView In C#
c# tutorial for beginners: How to connect Microsoft access database to C#
c# tutorial for beginners: How to get the sum of checked RadioButton Values
How to get selected text and selected value of comboBox in C#
c# tutorial for beginners: Retrieve data from access database and navigation buttons
c# tutorial for beginners: Delete row from datagridview and sql server database at once in C#
c# tutorial for beginners - How to search multiple columns access database using one textBox in C#
C# Tutorial - message box exit application
c# tutorial for beginners - How to get the selected items in the combobox and show them in a listbox
C#: datagridview change cell backcolor based on value
c# tutorial for beginners - How to make validation on textbox in c#
How to fill combobox from sql server database and get selected value from a combobox in c#
How to search data in datagridview in c# without using database
c# tutorial for beginners - Insert all data of a dataGridView to access database at once with code
Programming C#: How to prevent duplicate data when insert to datagridview
C#: Search for value in DataGridView in a column(without database)
C#:Show and hide characters password
Programming in C # tutorial: Login Form in C # with SQL Server with source code
C# tutorial| connect with access database with password to retrieve data into textboxes -source code
using System;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.OleDb;
namespace connect_access_with_password
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
OleDbConnection oledconn = new OleDbConnection(@"Provider=Microsoft.Ace.Oledb.12.0;Data Source=F:\ddd.accdb;Jet Oledb:Database Password=123456");
oledconn.Open();
OleDbCommand olecomm = new OleDbCommand("Select firstname,lastname,points from table1 Where id = @id", oledconn);
olecomm.Parameters.AddWithValue("id", textBox1.Text);
OleDbDataReader oledreader;
oledreader = olecomm.ExecuteReader();
if (oledreader.Read())
{
textBox2.Text = oledreader["firstname"].ToString();
textBox3.Text = oledreader["lastname"].ToString();
textBox4.Text = oledreader["points"].ToString();
}
else
{
textBox2.Text = "";
textBox3.Text = "";
textBox4.Text = "";
MessageBox.Show("No data found");
}
oledconn.Close();
}
}
}