Lecture 1
Lecture 1
Lecture 1
Antonios Daskos
class SimpleExample {
public static void Main() {
…
}
}
CSci485 C# Lecture 1 - Antonios Daskos
ADO.NET:
OleDbConnection
string connString = "Provider=Microsoft.Jet.OLEDB.4.0;
Data Source=C:\\Test Files\\Sample.mdb;
User Id=admin;Password=;";
OleDbConnection conn = new OleDbConnection(connString);
…
conn.Open();
…
conn.Close();
Connection string specifies server, database, user & password (if needed)
Close connections are added to a pool to be reused if the same connection
string is used. Saves much time in comparison to establishing a new
connection
Public Properties
ConnectionString, ConnectionTimeout, Database, DatabaseSource,
ServerVersion, State, WorkstationId
Public Methods
BeginTransaction(), ChangeDatabase(), Close(), CreateCommand(), Open()
Public Properties
CommandText, CommandTimeout, CommandType, Connection,
DesignTimeVisible, Parameters, Transaction, UpdatedRowSource
Public Methods
Cancel(), CreateParameter(), ExecuteNonQuery(), ExecuteReader(),
ExecuteScalar(), ExecuteXmlReader(), Prepare(), ResetCommandTimeout()
Public Properties
Depth, FieldCount, IsClosed, RecordsAffected
Public Methods
GetBoolean(), GetByte(), GetBytes(), GetChar(), GetChars(),
GetDataTypeName(), GetDateTime(), GetDecimal(), GetDouble(),
GetFieldType(), GetFloat(), GetGuid(), GetInt16(), GetInt32(), GetInt64(),
GetName(), GetOrdinal(), GetSchemaTable(), GetSqlBinary(), GetSqlBoolean(),
GetSqlByte(), GetSqlDateTime(), GetSqlDecimal(), GetSqlDouble(), GetSqlGuid(),
GetSqlInt16(), GetSqlInt32(), GetSqlInt64(), GetSqlMoney(), GetSqlSingle(),
GetSqlString(), GetSqlValue(), GetSqlValues(), GetString(), GetValue(),
GetValues(), IsDBNull(), NextResult(), Read()