Database Reference
In-Depth Information
// Open connection
conn.Open();
//Create command
cmd = new SqlCommand();
cmd.Connection = conn;
// Create table
CreateImageTable();
// Prepare insert
PrepareInsertImages();
// Loop for Inserting images
for (int i = 1; i <= numberImageFiles; i++)
{
ExecuteInsertImages(i);
}
}
catch (SqlException ex)
{
MessageBox.Show(ex.Message + ex.StackTrace);
}
finally
{
// Close connection
conn.Close();
txtLoadImages.AppendText(Environment.NewLine);
txtLoadImages.AppendText("Connection Closed.");
}
}
private void ExecuteCommand(string cmdText)
{
int cmdResult;
cmd.CommandText = cmdText;
//txtLoad.AppendText("Executing command:\n");
// txtLoad.AppendText(cmd.CommandText);
//txtLoad.AppendText(Environment.NewLine);
cmdResult = cmd.ExecuteNonQuery();
}
private void CreateImageTable()
{
ExecuteCommand(@"if exists
(select * from
INFORMATION_SCHEMA.TABLES
where TABLE_NAME = 'ImageTable')
Search WWH ::




Custom Search