Database Reference
In-Depth Information
// Create connection
SqlConnection conn = new SqlConnection(connString);
try
{
// Open connection
conn.Open();
// Create command
SqlCommand cmd = new SqlCommand(sql, conn);
// Create data reader
SqlDataReader rdr = cmd.ExecuteReader();
// Fetch data
while (rdr.Read())
{
// CardType
txtTypeAccess.AppendText(rdr.GetString(0).PadRight(30));
txtTypeAccess.AppendText("\t");
// CardNumber
txtTypeAccess.AppendText(rdr.GetString(1));
txtTypeAccess.AppendText("\t\t");
// ExpMonth
txtTypeAccess.AppendText(rdr.GetByte(2).ToString());
txtTypeAccess.AppendText("\t\t");
// ExpYear
txtTypeAccess.AppendText(rdr.GetInt16(3).ToString());
txtTypeAccess.AppendText("\n");
}
// Close data reader
rdr.Close();
}
catch (SqlException ex)
{
MessageBox.Show(ex.Message + ex.StackTrace,"Exception Details");
}
finally
{
// Close connection
conn.Close();
}
}
6. To set the TypedAccessor form as the start-up form, modify the Program.cs
statement.
Application.Run(new OrdinalIndexer ());
 
Search WWH ::




Custom Search