Form3.cs 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.SqlClient;
using MySql.Data.MySqlClient;
using System.Configuration;
namespace MySecureOTP
{
public partial class Form3 : Form
{
SqlConnection conn;
string connstring;
public Form3()
{
InitializeComponent();
connstring = ConfigurationManager.ConnectionStrings["MySecureOTP.Properties.Settings.MySecureOTPConnectionString"].ConnectionString;
}
public void open_mijoz()
{
using (conn = new SqlConnection(connstring))
using (SqlDataAdapter adapter = new SqlDataAdapter("SELECT * FROM mijoz", conn))
{
DataTable usertable = new DataTable();
adapter.Fill(usertable);
dataGridView1.DataSource = usertable;
}
}
{
SqlDataReader myreader;
string query = "SELECT * FROM mijoz";
using (conn = new SqlConnection(connstring))
using (SqlCommand command = new SqlCommand(query, conn))
{
conn.Open();
myreader = command.ExecuteReader();
while (myreader.Read())
{
string sname = myreader.GetString(1);
textBox1.Text = sname;
//textBox24.Text = sname;
}
}
}
private void Form3_Load(object sender, EventArgs e)
{
open_mijoz();
otpshow();
}
}
}
Form4.cs 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;
namespace MySecureOTP
{
public partial class Form4 : Form
{
public Form4()
{
InitializeComponent();
}
}
}