?? dbdataset.designer.cs
字號:
?//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.1433
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace DeviceSQLDemo2.DBResultSets {
using System;
using System.Data;
public partial class OrdersResultSet : System.Data.SqlServerCe.SqlCeResultSet {
private bool disposed = false;
private string resultSetConnectionString = null;
private System.Data.SqlServerCe.SqlCeConnection sqlCeConnection = null;
private System.Data.SqlServerCe.ResultSetOptions resultSetOptions;
public OrdersResultSet() {
// Create default options
//
resultSetOptions = System.Data.SqlServerCe.ResultSetOptions.Scrollable;
resultSetOptions = (resultSetOptions | System.Data.SqlServerCe.ResultSetOptions.Sensitive);
resultSetOptions = (resultSetOptions | System.Data.SqlServerCe.ResultSetOptions.Updatable);
// To enable design time support, the resultSetConnectionString property needs to switched between a Designtime and Runtime connection string.
// The design time connection string is used to make a valid connection to the database and retrieve schema information.
//
if (DBDataSetUtil.DesignerUtil.IsDesignTime()) {
// Designtime Connection String
resultSetConnectionString = "Data Source=E:\\DeviceDev\\DeviceSQLDemo2\\DeviceSQLDemo2\\DB.sdf";
}
else {
// Runtime Connection String
resultSetConnectionString = ("Data Source ="
+ (System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase) + "\\DB.sdf;"));
}
// Call Open() to initialize the ResultSet
//
this.Open();
}
public OrdersResultSet(string connectionString, System.Data.SqlServerCe.ResultSetOptions options) {
resultSetConnectionString = connectionString;
resultSetOptions = options;
this.Open();
}
public System.Data.SqlServerCe.SqlCeConnection Connection {
get {
return sqlCeConnection;
}
}
public int SysNo {
get {
return ((int)(base.GetInt32(base.GetOrdinal("SysNo"))));
}
set {
base.SetInt32(base.GetOrdinal("SysNo"), value);
}
}
public System.DateTime OrderDate {
get {
return ((System.DateTime)(base.GetDateTime(base.GetOrdinal("OrderDate"))));
}
set {
base.SetDateTime(base.GetOrdinal("OrderDate"), value);
}
}
public string Customer {
get {
return ((string)(base.GetString(base.GetOrdinal("Customer"))));
}
set {
base.SetString(base.GetOrdinal("Customer"), value);
}
}
public int ProductSysNo {
get {
return ((int)(base.GetInt32(base.GetOrdinal("ProductSysNo"))));
}
set {
base.SetInt32(base.GetOrdinal("ProductSysNo"), value);
}
}
public int Qty {
get {
return ((int)(base.GetInt32(base.GetOrdinal("Qty"))));
}
set {
base.SetInt32(base.GetOrdinal("Qty"), value);
}
}
public decimal Price {
get {
try {
return ((decimal)(base.GetDecimal(base.GetOrdinal("Price"))));
}
catch (System.InvalidCastException e) {
throw new System.Data.StrongTypingException("StrongTyping_CananotAccessDBNull", e);
}
}
set {
base.SetDecimal(base.GetOrdinal("Price"), value);
}
}
public void Open() {
System.Data.SqlServerCe.SqlCeCommand sqlCeSelectCommand = null;
try {
// Open a connection to the database
//
sqlCeConnection = new System.Data.SqlServerCe.SqlCeConnection(this.resultSetConnectionString);
sqlCeConnection.Open();
// Create the command
//
sqlCeSelectCommand = sqlCeConnection.CreateCommand();
sqlCeSelectCommand.CommandText = "Orders";
sqlCeSelectCommand.CommandType = System.Data.CommandType.TableDirect;
// Generate the ResultSet
//
sqlCeSelectCommand.ExecuteResultSet(this.resultSetOptions, this);
}
finally {
if ((sqlCeSelectCommand != null)) {
sqlCeSelectCommand.Dispose();
}
}
}
public void MoveToRow(int Row) {
base.ReadAbsolute(Row);
}
public void DeleteRecord() {
base.Delete();
}
public bool IsPriceNull() {
return base.IsDBNull(base.GetOrdinal("Price"));
}
public void SetPriceNull() {
base.SetValue(base.GetOrdinal("Price"), System.DBNull.Value);
}
public void AddOrdersRecord(System.DateTime OrderDate, string Customer, int ProductSysNo, int Qty, decimal Price) {
System.Data.SqlServerCe.SqlCeUpdatableRecord newRecord = base.CreateRecord();
newRecord["OrderDate"] = OrderDate;
newRecord["Customer"] = Customer;
newRecord["ProductSysNo"] = ProductSysNo;
newRecord["Qty"] = Qty;
newRecord["Price"] = Price;
base.Insert(newRecord);
}
public void Bind(System.Windows.Forms.BindingSource bindingSource) {
bindingSource.DataSource = this.ResultSetView;
}
protected override void Dispose(bool disposing) {
if (disposed) {
return;
}
try {
if (disposing) {
sqlCeConnection.Dispose();
}
disposed = true;
}
finally {
base.Dispose(disposing);
}
}
}
}
namespace DBDataSetUtil {
using System;
using System.Data;
public partial class DesignerUtil {
public static bool IsDesignTime() {
// Determine if this instance is running against .NET Framework by using the MSCoreLib PublicKeyToken
System.Reflection.Assembly mscorlibAssembly = typeof(int).Assembly;
if ((mscorlibAssembly != null)) {
if (mscorlibAssembly.FullName.ToUpper().EndsWith("B77A5C561934E089")) {
return true;
}
}
return false;
}
public static bool IsRunTime() {
// Determine if this instance is running against .NET Compact Framework by using the MSCoreLib PublicKeyToken
System.Reflection.Assembly mscorlibAssembly = typeof(int).Assembly;
if ((mscorlibAssembly != null)) {
if (mscorlibAssembly.FullName.ToUpper().EndsWith("969DB8053D3322AC")) {
return true;
}
}
return false;
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -