📄 joinqueryresultset.designer.cs
字号:
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.312
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace MobileDevelopersHandbook.JoinQueryResultSetResultSets {
using System;
using System.Data;
public partial class ProductsCategoryResultSet : System.Data.SqlServerCe.SqlCeResultSet {
private string resultSetConnectionString = null;
private System.Data.SqlServerCe.SqlCeConnection sqlCeConnection = null;
private System.Data.SqlServerCe.ResultSetOptions resultSetOptions;
public ProductsCategoryResultSet() {
// 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 (JoinQueryResultSetUtil.DesignerUtil.IsDesignTime()) {
// Designtime Connection String
resultSetConnectionString = "Data Source =\"C:\\Users\\Andy\\Documents\\Compact Framework Book V2.0\\Sample Code\\Cha" +
"pter 3\\CS\\SQLCEDataSetsAndSqlCeResultSets\\SQLCEDataSetsAndSqlCeResultSets\\MyData" +
"base.sdf\"; Password =\"MobileP@ssw0rd\";";
}
else {
// Runtime Connection String
resultSetConnectionString = ("Data Source ="
+ (System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase)
+ ("\\MyDatabase.sdf;"
+ ("Password =" + "\"MobileP@ssw0rd\";"))));
}
// Call Open() to initialize the ResultSet
//
this.Open();
}
public ProductsCategoryResultSet(string connectionString, System.Data.SqlServerCe.ResultSetOptions options) {
resultSetConnectionString = connectionString;
resultSetOptions = options;
this.Open();
}
public System.Data.SqlServerCe.SqlCeConnection Connection {
get {
return sqlCeConnection;
}
}
public int ProductID {
get {
try {
return ((int)(base.GetInt32(base.GetOrdinal("ProductID"))));
}
catch (System.InvalidCastException e) {
throw new System.Data.StrongTypingException("StrongTyping_CananotAccessDBNull", e);
}
}
set {
base.SetInt32(base.GetOrdinal("ProductID"), value);
}
}
public string Name {
get {
try {
return ((string)(base.GetString(base.GetOrdinal("Name"))));
}
catch (System.InvalidCastException e) {
throw new System.Data.StrongTypingException("StrongTyping_CananotAccessDBNull", e);
}
}
set {
base.SetString(base.GetOrdinal("Name"), value);
}
}
public string Size {
get {
try {
return ((string)(base.GetString(base.GetOrdinal("Size"))));
}
catch (System.InvalidCastException e) {
throw new System.Data.StrongTypingException("StrongTyping_CananotAccessDBNull", e);
}
}
set {
base.SetString(base.GetOrdinal("Size"), value);
}
}
public string CategoryName {
get {
try {
return ((string)(base.GetString(base.GetOrdinal("CategoryName"))));
}
catch (System.InvalidCastException e) {
throw new System.Data.StrongTypingException("StrongTyping_CananotAccessDBNull", e);
}
}
set {
base.SetString(base.GetOrdinal("CategoryName"), value);
}
}
public void Open() {
System.Data.SqlServerCe.SqlCeCommand sqlCeSelectCommand;
// Open a connection to the database
//
sqlCeConnection = new System.Data.SqlServerCe.SqlCeConnection(this.resultSetConnectionString);
sqlCeConnection.Open();
// Create the command
//
sqlCeSelectCommand = sqlCeConnection.CreateCommand();
sqlCeSelectCommand.CommandText = "ProductsCategory";
sqlCeSelectCommand.CommandType = System.Data.CommandType.TableDirect;
// Generate the ResultSet
//
sqlCeSelectCommand.ExecuteResultSet(this.resultSetOptions, this);
}
public void MoveToRow(int Row) {
base.ReadAbsolute(Row);
}
public void DeleteRecord() {
base.Delete();
}
public bool IsProductIDNull() {
return base.IsDBNull(base.GetOrdinal("ProductID"));
}
public void SetProductIDNull() {
base.SetValue(base.GetOrdinal("ProductID"), System.DBNull.Value);
}
public bool IsNameNull() {
return base.IsDBNull(base.GetOrdinal("Name"));
}
public void SetNameNull() {
base.SetValue(base.GetOrdinal("Name"), System.DBNull.Value);
}
public bool IsSizeNull() {
return base.IsDBNull(base.GetOrdinal("Size"));
}
public void SetSizeNull() {
base.SetValue(base.GetOrdinal("Size"), System.DBNull.Value);
}
public bool IsCategoryNameNull() {
return base.IsDBNull(base.GetOrdinal("CategoryName"));
}
public void SetCategoryNameNull() {
base.SetValue(base.GetOrdinal("CategoryName"), System.DBNull.Value);
}
public void AddProductsCategoryRecord(int ProductID, string Name, string Size, string CategoryName) {
System.Data.SqlServerCe.SqlCeUpdatableRecord newRecord = base.CreateRecord();
newRecord["ProductID"] = ProductID;
newRecord["Name"] = Name;
newRecord["Size"] = Size;
newRecord["CategoryName"] = CategoryName;
base.Insert(newRecord);
}
public void Bind(System.Windows.Forms.BindingSource bindingSource) {
bindingSource.DataSource = this.ResultSetView;
}
}
}
namespace JoinQueryResultSetUtil {
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 + -