Question
I connect with the database and enter the ID and password, but I cannot bring the rest of the information in the newly opened form,
I connect with the database and enter the ID and password, but I cannot bring the rest of the information in the newly opened form, can you please help? note: I just want the id,name,surname and department data to come automatically in the newly opened form as I have shown in the picture.
Here I put the c# code I wrote to do this, under the picture, what should I add so that other information comes automatically.
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.SQLite;
namespace Term_Project { public partial class SLogin : Form { SQLiteCommand cmd; SQLiteDataReader dr; SQLiteConnection conn;
public SLogin() { conn = new SQLiteConnection("Data Source=C:\\Users\\B\\Desktop\\TermDB.db; Version=3");
InitializeComponent(); }
private void button1_Click(object sender, EventArgs e) { string user = textBox1.Text; string pass = textBox2.Text; cmd = new SQLiteCommand(); conn.Open(); cmd.Connection = conn; cmd.CommandText = "Select * From Student Where ID=" + user + " AND Password=" + pass + ""; dr = cmd.ExecuteReader();
if (dr.Read()) { MessageBox.Show("Login Success."); Student std = new Student(); std.Show(); this.Hide(); } else { MessageBox.Show("Invalid login Please Check Username And Password"); } conn.Close(); } } }
ID Name Surname Filtre Filtre Filtre 1 300 LB James Dept_Name Password Filtre Filtre Computer Engineering 300 11 SLogin ID 300 2 Password Login Student - 0 ID IN Name 3 Sumame DepartmentStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started