Silentgamerz
Silentgamerz
CC#
Created by Silentgamerz on 8/6/2023 in #help
✅ how to call a function from another window WPF
I tried using this code but it wasnt working
private void Upload(object sender, RoutedEventArgs e)
{
try
{
int dsCode = Convert.ToInt32(Name_txt.Text);
byte[] images = null;
FileStream stream = new FileStream(imglocation,FileMode.Open,FileAccess.Read);
BinaryReader brs = new BinaryReader(stream);
images = brs.ReadBytes((int)stream.Length);
SqlCommand insertCMD = new SqlCommand("insert into DesignTB(DesignCode,DesignIMG) values(@dsCode,@images)");
insertCMD.Parameters.AddWithValue("@dsCode",dsCode);
insertCMD.Parameters.AddWithValue("@images",images);
int row = dBAccess.executeQuery(insertCMD);
if (row == 1)
{
ManageStock manageStock = new ManageStock();
manageStock.LoadList();
Close();
}
}
catch (Exception)
{
MessageBox.Show("Unsuccessful");
}
}
}
}
private void Upload(object sender, RoutedEventArgs e)
{
try
{
int dsCode = Convert.ToInt32(Name_txt.Text);
byte[] images = null;
FileStream stream = new FileStream(imglocation,FileMode.Open,FileAccess.Read);
BinaryReader brs = new BinaryReader(stream);
images = brs.ReadBytes((int)stream.Length);
SqlCommand insertCMD = new SqlCommand("insert into DesignTB(DesignCode,DesignIMG) values(@dsCode,@images)");
insertCMD.Parameters.AddWithValue("@dsCode",dsCode);
insertCMD.Parameters.AddWithValue("@images",images);
int row = dBAccess.executeQuery(insertCMD);
if (row == 1)
{
ManageStock manageStock = new ManageStock();
manageStock.LoadList();
Close();
}
}
catch (Exception)
{
MessageBox.Show("Unsuccessful");
}
}
}
}
public void LoadList() {
string query = "select * from DesignTB";
dBAccess.readDatathroughAdapter(query, dt);
lstBox.ItemsSource = dt.DefaultView;
dBAccess.closeConn();
}
public void LoadList() {
string query = "select * from DesignTB";
dBAccess.readDatathroughAdapter(query, dt);
lstBox.ItemsSource = dt.DefaultView;
dBAccess.closeConn();
}
74 replies
CC#
Created by Silentgamerz on 7/20/2023 in #help
✅ ListView Not Showing real values
8 replies
CC#
Created by Silentgamerz on 7/15/2023 in #help
✅ is there a way to read names of image files
I want to create a program tht reads name of image all files in a folder and uploads it to a SQL database
24 replies
CC#
Created by Silentgamerz on 7/10/2023 in #help
✅ unable to connect Microsoft SQL in visual studio wpf
12 replies