This is the code of the form where the Plus sign is there and also the MemberId textbox is also there.That is Form1.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.Text.RegularExpressions;
namespace CDShop
{
public partial class Form_BorrowSection : Form
{
public Form_BorrowSection()
{
InitializeComponent();
}
Int32 memberid { get; set; }
public void getMemberid()
{
Int32 id;
id = Convert.ToInt32(textBox_MemberID.Text);
memberid = id;
}
Here is the code of the Form2 .
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace CDShop
{
public partial class Form_Borrowed_Items : Form
{
public Form_Borrowed_Items()
{
InitializeComponent();
}
private void Form_Borrowed_Items_Load(object sender, EventArgs e)
{
label1.Text = fb.memberid;//fb is the Form1 object
string b = "Borrowed";
string query = "select * from Table_Borrow where MemberID=@parameter1 and Status LIKE '" + b.ToString() + "' ";
using (SqlConnection con = new SqlConnection("Data Source=INVENTOR-1D70F6\\SQLEXPRESS;Initial Catalog=AnindyaCD;Integrated Security=SSPI"))
{
using (SqlCommand cmd = new SqlCommand(query, con))
{
cmd.Parameters.AddWithValue("@parameter1", MemberID);
using (SqlDataAdapter ad = new SqlDataAdapter(query, con))
{
ad.SelectCommand = cmd;
DataSet ds = new DataSet();
ad.Fill(ds, "Table_Borrow");
dataGridView5.DataSource = ds.Tables[0];
}
}
}
}
}
}
error.JPGExperts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.
When asked, what has been your best career decision?
Deciding to stick with EE.
Being involved with EE helped me to grow personally and professionally.
Connect with Certified Experts to gain insight and support on specific technology challenges including:
We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE