本文整理汇总了C#中ADODB.Recordset.MoveFirst方法的典型用法代码示例。如果您正苦于以下问题:C# ADODB.Recordset.MoveFirst方法的具体用法?C# ADODB.Recordset.MoveFirst怎么用?C# ADODB.Recordset.MoveFirst使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ADODB.Recordset
的用法示例。
在下文中一共展示了ADODB.Recordset.MoveFirst方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: cmdCancel_Click
private void cmdCancel_Click()
{
bool mbDataChanged = false;
int mvBookMark = 0;
ADODB.Recordset adoPrimaryRS = new ADODB.Recordset();
bool mbAddNewFlag = false;
bool mbEditFlag = false;
// ERROR: Not supported in C#: OnErrorStatement
if (mbAddNewFlag) {
this.Close();
} else {
mbEditFlag = false;
mbAddNewFlag = false;
adoPrimaryRS.CancelUpdate();
if (mvBookMark > 0) {
adoPrimaryRS.Bookmark = mvBookMark;
} else {
adoPrimaryRS.MoveFirst();
}
mbDataChanged = false;
}
}
示例2: Main
//.........这里部分代码省略.........
"CountryRegionCode", // 参数名
ADODB.DataTypeEnum.adVarChar, // 参数类型 (nvarchar(20))
ADODB.ParameterDirectionEnum.adParamInput, // 参数类型
20, // 参数的最大长度
"ZZ"+DateTime.Now.Millisecond); // 参数值
cmdInsert.Parameters.Append(paramCode);
// Name (nvarchar(200))参数的添加
ADODB.Parameter paramName = cmdInsert.CreateParameter(
"Name", // 参数名
ADODB.DataTypeEnum.adVarChar, // 参数类型 (nvarchar(200))
ADODB.ParameterDirectionEnum.adParamInput, // 参数传递方向
200, // 参数的最大长度
"Test Region Name"); // 参数值
cmdInsert.Parameters.Append(paramName);
// ModifiedDate (datetime)参数的添加
ADODB.Parameter paramModifiedDate = cmdInsert.CreateParameter(
"ModifiedDate", // 参数名
ADODB.DataTypeEnum.adDate, // 参数类型 (datetime)
ADODB.ParameterDirectionEnum.adParamInput, // 参数传递方向
-1, // 参数的最大长度 (datetime忽视该值)
DateTime.Now); // 参数值
cmdInsert.Parameters.Append(paramModifiedDate);
// 6. 执行命令
object nRecordsAffected = Type.Missing;
object oParams = Type.Missing;
cmdInsert.Execute(out nRecordsAffected, ref oParams,
(int)ADODB.ExecuteOptionEnum.adExecuteNoRecords);
////////////////////////////////////////////////////////////////////////////////
// 使用Recordset对象.
// http://msdn.microsoft.com/en-us/library/ms681510.aspx
// Recordset表示了数据表中记录或执行命令获得的结果的集合。
// 在任何时候, Recordset对象都指向集合中的单条记录,并将
// 该记录作为它的当前记录。
//
Console.WriteLine("列出表CountryRegion中的所有记录");
// 1. 生成Recordset对象
rs = new ADODB.Recordset();
// 2. 打开Recordset对象
string strSelectCmd = "SELECT * FROM CountryRegion"; // WHERE ...
rs.Open(strSelectCmd, // SQL指令/表,视图名 /
// 存储过程调用 /文件名
conn, // 连接对象/连接字符串
ADODB.CursorTypeEnum.adOpenForwardOnly, // 游标类型. (只进游标)
ADODB.LockTypeEnum.adLockOptimistic, // 锁定类型. (仅当需要调用
// 更新方法时,才锁定记录)
(int)ADODB.CommandTypeEnum.adCmdText); // 将第一个参数视为SQL命令
// 或存储过程.
// 3. 通过向前移动游标列举记录
// 移动到Recordset中的第一条记录
rs.MoveFirst();
while (!rs.EOF)
{
// 当在表中定义了一个可空字段,需要检验字段中的值是否为DBNull.Value.
string code = (rs.Fields["CountryRegionCode"].Value == DBNull.Value) ?
"(DBNull)" : rs.Fields["CountryRegionCode"].Value.ToString();
string name = (rs.Fields["Name"].Value == DBNull.Value) ?
"(DBNull)" : rs.Fields["Name"].Value.ToString();
DateTime modifiedDate = (rs.Fields["ModifiedDate"].Value == DBNull.Value) ?
DateTime.MinValue : (DateTime)rs.Fields["ModifiedDate"].Value;
Console.WriteLine(" {2} \t{0}\t{1}", code, name, modifiedDate.ToString("yyyy-MM-dd"));
// 移动到下一条记录
rs.MoveNext();
}
}
catch (Exception ex)
{
Console.WriteLine("应用程序出现错误: {0}", ex.Message);
if (ex.InnerException != null)
Console.WriteLine("描述: {0}", ex.InnerException.Message);
}
finally
{
////////////////////////////////////////////////////////////////////////////////
// 退出前清理对象.
//
Console.WriteLine("正在关闭连接 ...");
// 关闭record set,当它处于打开状态时
if (rs != null && rs.State == (int)ADODB.ObjectStateEnum.adStateOpen)
rs.Close();
// 关闭数据库连接,当它处于打开状态时
if (conn != null && conn.State == (int)ADODB.ObjectStateEnum.adStateOpen)
conn.Close();
}
}
示例3: cmdShow_Click
private void cmdShow_Click(System.Object eventSender, System.EventArgs eventArgs)
{
int x = 0;
// ERROR: Not supported in C#: OnErrorStatement
ADODB.Recordset rs = default(ADODB.Recordset);
ADODB.Recordset rs1 = default(ADODB.Recordset);
ADODB.Recordset rs2 = default(ADODB.Recordset);
ADODB.Recordset rsB = default(ADODB.Recordset);
ADODB.Recordset rsDcheck = default(ADODB.Recordset);
decimal HMyPrice = default(decimal);
string MyMarkup = null;
decimal HMyPrice1 = default(decimal);
double MyCounterF = 0;
double MyCounterL = 0;
string Delimiter = null;
ADODB.Recordset rsk = default(ADODB.Recordset);
rs = new ADODB.Recordset();
rs1 = new ADODB.Recordset();
rs2 = new ADODB.Recordset();
rsB = new ADODB.Recordset();
rsDcheck = new ADODB.Recordset();
rsk = new ADODB.Recordset();
Delimiter = " ";
//create table name
modApplication.Te_Names = "NewPricechanges";
//In case the table was not dropped then drop it
rs = modRecordSet.getRS(ref "DROP TABLE " + modApplication.Te_Names + "");
modApplication.MyFTypess = "PriceChangesID_DayEndStockItemLnk Number,PriceChanges_StockItemName Text(50),OldPrice Currency,NewPrice Currency,SellingPrice Currency,Markup Number";
//create table NewPriceChanges
modRecordSet.cnnDB.Execute("CREATE TABLE " + modApplication.Te_Names + " (" + modApplication.MyFTypess + ")");
rs1 = modRecordSet.getRS(ref "SELECT DayEnd.DayEndID, DayEnd.DayEnd_Date, DayEndStockItemLnk.DayEndStockItemLnk_StockItemID, aStockItem1.StockItem_Name, DayEndStockItemLnk.DayEndStockItemLnk_ListCost, aStockItem1.StockItemID FROM Report INNER JOIN (DayEnd INNER JOIN (DayEndStockItemLnk INNER JOIN aStockItem1 ON DayEndStockItemLnk.DayEndStockItemLnk_StockItemID = aStockItem1.StockItemID) ON DayEnd.DayEndID = DayEndStockItemLnk.DayEndStockItemLnk_DayEndID) ON Report.Report_DayEndEndID = DayEnd.DayEndID ORDER BY aStockItem1.StockItemID;");
if (rs1.RecordCount) {
while (!(rs1.EOF)) {
rs2 = modRecordSet.getRS(ref "SELECT DayEnd.DayEndID, DayEnd.DayEnd_Date, DayEndStockItemLnk.DayEndStockItemLnk_StockItemID, aStockItem1.StockItem_Name, DayEndStockItemLnk.DayEndStockItemLnk_ListCost, aStockItem1.StockItemID FROM Report INNER JOIN (DayEnd INNER JOIN (DayEndStockItemLnk INNER JOIN aStockItem1 ON DayEndStockItemLnk.DayEndStockItemLnk_StockItemID = aStockItem1.StockItemID) ON DayEnd.DayEndID = DayEndStockItemLnk.DayEndStockItemLnk_DayEndID) ON Report.Report_DayEndStartID = DayEnd.DayEndID WHERE (((aStockItem1.StockItemID)=" + rs1.Fields("DayEndStockItemLnk_StockItemID").Value + "));");
if (rs2.RecordCount) {
if (rs1.Fields("DayEndStockItemLnk_ListCost").Value != rs2.Fields("DayEndStockItemLnk_ListCost").Value) {
MyMarkup = Convert.ToString(0);
//MyMarkup = (rs2("DayEndStockItemLnk_ListCost") / rsB("CatalogueChannelLnk_Price") * 100)
//MyMarkup = 100 - MyMarkup
//insert into Newpricechanges
modRecordSet.cnnDB.Execute("INSERT INTO " + modApplication.Te_Names + "(PriceChangesID_DayEndStockItemLnk,PriceChanges_StockItemName,OldPrice,NewPrice,SellingPrice,Markup)VALUES(" + rs1.Fields("DayEndStockItemLnk_StockItemID").Value + ",'" + rs1.Fields("StockItem_Name").Value + "', " + rs1.Fields("DayEndStockItemLnk_ListCost").Value + ", " + rs2.Fields("DayEndStockItemLnk_ListCost").Value + "," + rs1.Fields("DayEndStockItemLnk_ListCost").Value + "," + MyMarkup + ")");
//delete duplicates
//Set rsk = getRS("DELETE * FROM " & Te_Names & " WHERE (NewPricechanges.PriceChangesID_DayEndStockItemLnk =" & rs2("DayEndStockItemLnk_StockItemID") & " and NewPricechanges.OldPrice = " & rs2("DayEndStockItemLnk_ListCost") & " and NewPricechanges.NewPrice = " & rs2("DayEndStockItemLnk_ListCost") & ")")
}
}
rs1.moveNext();
}
} else {
Interaction.MsgBox("There was No Price Changes of Items between " + this.txtstartdate.Text + " And " + this.txtenddate.Text, MsgBoxStyle.Information, "4POS");
}
//validation for start date
if (string.IsNullOrEmpty(this.txtstartdate.Text)) {
Interaction.MsgBox("Please Select/enter the Start Date", MsgBoxStyle.ApplicationModal + MsgBoxStyle.OkCancel, "4POS");
this.txtstartdate.Focus();
return;
//validation for end date
} else if (string.IsNullOrEmpty(this.txtenddate.Text)) {
Interaction.MsgBox("Please Select/enter the End Date", MsgBoxStyle.ApplicationModal + MsgBoxStyle.OkCancel, "4POS");
this.txtenddate.Focus();
return;
}
//create table name
modApplication.Te_Names = "NewPricechanges";
//In case the table was not dropped then drop it
rs = modRecordSet.getRS(ref "DROP TABLE " + modApplication.Te_Names + "");
modApplication.MyFTypess = "PriceChangesID_DayEndStockItemLnk Number,PriceChanges_StockItemName Text(50),OldPrice Currency,NewPrice Currency,SellingPrice Currency,Markup Number";
//create table NewPriceChanges
modRecordSet.cnnDB.Execute("CREATE TABLE " + modApplication.Te_Names + " (" + modApplication.MyFTypess + ")");
//selecting from the start date
rs = modRecordSet.getRS(ref "SELECT * FROM DayEnd WHERE Datevalue(DayEnd_Date)=#" + this.txtstartdate.Text + "#");
//selecting from the end date
rs1 = modRecordSet.getRS(ref "SELECT * FROM DayEnd WHERE Datevalue(DayEnd_Date) = #" + this.txtenddate.Text + "#");
this.cmdshow.Enabled = false;
this.cmdcancel.Enabled = false;
//assigning the start date and the end date to the below variables
MyCounterF = rs.Fields("DayEndID").Value;
MyCounterL = rs1.Fields("DayEndID").Value;
//loop/round from the first date until the last date selected
for (x = MyCounterF; x <= MyCounterL; x++) {
rs2 = modRecordSet.getRS(ref "SELECT * FROM DayEndStockItemLnk WHERE DayEndStockItemLnk_StockItemID=" + MyCounterF + "");
rsB = modRecordSet.getRS(ref "SELECT * FROM CatalogueChannelLnk WHERE CatalogueChannelLnk_StockItemID=" + MyCounterF + "");
rs = modRecordSet.getRS(ref "SELECT * FROM StockItem WHERE StockItemID=" + rs2.Fields("DayEndStockItemLnk_StockItemID").Value + "");
rs2.MoveFirst();
//formating the price
HMyPrice1 = rs2.Fields("DayEndStockItemLnk_ListCost").Value;
HMyPrice1 = Convert.ToDecimal(Strings.Format(HMyPrice1, "R# ,###.##"));
//formating the price
HMyPrice = rs2.Fields("DayEndStockItemLnk_ListCost").Value;
HMyPrice = Convert.ToDecimal(Strings.Format(HMyPrice, "R# ,###.##"));
rs2.Fields("DayEndStockItemLnk_ListCost").Value = Strings.Format(rs2.Fields("DayEndStockItemLnk_ListCost").Value, "R # ,###.##");
//.........这里部分代码省略.........
示例4: OLD_cmdShow_Click
private void OLD_cmdShow_Click()
{
int x = 0;
// ERROR: Not supported in C#: OnErrorStatement
ADODB.Recordset rs = default(ADODB.Recordset);
ADODB.Recordset rs1 = default(ADODB.Recordset);
ADODB.Recordset rs2 = default(ADODB.Recordset);
ADODB.Recordset rsB = default(ADODB.Recordset);
ADODB.Recordset rsDcheck = default(ADODB.Recordset);
decimal HMyPrice = default(decimal);
string MyMarkup = null;
decimal HMyPrice1 = default(decimal);
double MyCounterF = 0;
double MyCounterL = 0;
string Delimiter = null;
ADODB.Recordset rsk = default(ADODB.Recordset);
rs = new ADODB.Recordset();
rs1 = new ADODB.Recordset();
rs2 = new ADODB.Recordset();
rsB = new ADODB.Recordset();
rsDcheck = new ADODB.Recordset();
rsk = new ADODB.Recordset();
Delimiter = " ";
//Set rs = getRS("SELECT * FROM DayEnd WHERE DayEnd_Date = " & Me.txtstartdate.Text & "")
//validation for start date
if (string.IsNullOrEmpty(this.txtstartdate.Text)) {
Interaction.MsgBox("Please Select/enter the Start Date", MsgBoxStyle.ApplicationModal + MsgBoxStyle.OkCancel, "4POS");
this.txtstartdate.Focus();
return;
//validation for end date
} else if (string.IsNullOrEmpty(this.txtenddate.Text)) {
Interaction.MsgBox("Please Select/enter the End Date", MsgBoxStyle.ApplicationModal + MsgBoxStyle.OkCancel, "4POS");
this.txtenddate.Focus();
return;
}
//create table name
modApplication.Te_Names = "NewPricechanges";
//In case the table was not dropped then drop it
rs = modRecordSet.getRS(ref "DROP TABLE " + modApplication.Te_Names + "");
//selecting from dayend
rsDcheck = modRecordSet.getRS(ref "SELECT * FROM DayEnd");
rsDcheck.MoveFirst();
//looping through all the selected records
while (!(rsDcheck.EOF)) {
//rsDcheck("DayEnd_Date") = Trim(Mid(rsDcheck("DayEnd_Date"), Len(rsDcheck("DayEnd_Date")) - 2, InStr(1, rsDcheck("DayEnd_Date"), Delimiter, Len(rsDcheck("DayEnd_Date")) - 1)))
//formarting the date and time to just date
rsDcheck.Fields("DayEnd_Date").Value = Strings.Trim(Strings.Mid(rsDcheck.Fields("DayEnd_Date").Value, 1, Strings.InStr(1, rsDcheck.Fields("DayEnd_Date").Value, Delimiter, 1) - 1));
//updating the date fields to only date not date and time
rs = modRecordSet.getRS(ref "UPDATE DayEnd SET DayEnd_Date=#" + rsDcheck.Fields("DayEnd_Date").Value + "# WHERE DayEndID=" + rsDcheck.Fields("DayEndID").Value + "");
rsDcheck.moveNext();
}
modApplication.MyFTypess = "PriceChangesID_DayEndStockItemLnk Number,PriceChanges_StockItemName Text(50),OldPrice Currency,NewPrice Currency,SellingPrice Currency,Markup Number";
//create table NewPriceChanges
modRecordSet.cnnDB.Execute("CREATE TABLE " + modApplication.Te_Names + " (" + modApplication.MyFTypess + ")");
//selecting from the start date
rs = modRecordSet.getRS(ref "SELECT * FROM DayEnd WHERE (DayEnd_Date=#" + this.txtstartdate.Text + "#)");
//selecting from the end date
rs1 = modRecordSet.getRS(ref "SELECT * FROM DayEnd WHERE (DayEnd_Date = #" + this.txtenddate.Text + "#)");
//MyDayendIDs = rs("DayEndID")
//MyDayendIDs1 = rs1("DayEndID")
this.cmdshow.Enabled = false;
this.cmdcancel.Enabled = false;
//assigning the start date and the end date to the below variables
MyCounterF = rs.Fields("DayEndID").Value;
MyCounterL = rs1.Fields("DayEndID").Value;
//loop/round from the first date until the last date selected
for (x = MyCounterF; x <= MyCounterL; x++) {
rs2 = modRecordSet.getRS(ref "SELECT * FROM DayEndStockItemLnk WHERE DayEndStockItemLnk_StockItemID=" + MyCounterF + "");
rsB = modRecordSet.getRS(ref "SELECT * FROM CatalogueChannelLnk WHERE CatalogueChannelLnk_StockItemID=" + MyCounterF + "");
rs = modRecordSet.getRS(ref "SELECT * FROM StockItem WHERE StockItemID=" + rs2.Fields("DayEndStockItemLnk_StockItemID").Value + "");
rs2.MoveFirst();
//formating the price
HMyPrice1 = rs2.Fields("DayEndStockItemLnk_ListCost").Value;
HMyPrice1 = Convert.ToDecimal(Strings.Format(HMyPrice1, "R# ,###.##"));
//formating the price
HMyPrice = rs2.Fields("DayEndStockItemLnk_ListCost").Value;
HMyPrice = Convert.ToDecimal(Strings.Format(HMyPrice, "R# ,###.##"));
rs2.Fields("DayEndStockItemLnk_ListCost").Value = Strings.Format(rs2.Fields("DayEndStockItemLnk_ListCost").Value, "R # ,###.##");
while (!(rs2.EOF)) {
//looping through the price for a specific date,if the price differs then insert into newly created table
if (rs2.Fields("DayEndStockItemLnk_ListCost").Value != HMyPrice) {
//rsB("CatalogueChannelLnk_Price") = rsB("CatalogueChannelLnk_Price")
HMyPrice = rs2.Fields("DayEndStockItemLnk_ListCost").Value;
//.........这里部分代码省略.........
示例5: getAddress
public string getAddress()
{
try
{
Position PoiX = new Position();
PoiX.X = Lat; PoiX.Y = Lon;
double tempLen = 1000000;
string tempTown = "";
ADODB.Recordset RST = new ADODB.Recordset();
string sqlSTR = "SELECT name,the_geom FROM mergedpoints WHERE the_geom && 'BOX3D(" +
(Lon - 0.5) + " " + (Lat - 0.5) + "," + (Lon + 0.5) + " " + (Lat + 0.5) +
") '::box3d AND distance( the_geom, GeometryFromText( 'POINT(" + Lon + " " + Lat +
")', -1 ) ) < 0.5";
string sqlSTROther = "SELECT name,the_geom FROM mergedpoints WHERE the_geom && 'BOX3D(" +
(Lon - 6) + " " + (Lat - 6) + "," + (Lon + 6) + " " + (Lat + 6) +
") '::box3d AND distance( the_geom, GeometryFromText( 'POINT(" + Lon + " " + Lat +
")', -1 ) ) < 7";
RST.Open(sqlSTR, this.odbcDatabaseConnection, ADODB.CursorTypeEnum.adOpenDynamic,
ADODB.LockTypeEnum.adLockBatchOptimistic, 0);
if (RST.EOF == true)
{
try { RST.Close(); }
catch { }
RST.Open(sqlSTROther, this.odbcDatabaseConnection, ADODB.CursorTypeEnum.adOpenDynamic,
ADODB.LockTypeEnum.adLockBatchOptimistic, 0);
}
if (RST.EOF == false)
{
RST.MoveFirst();
while (RST.EOF == false)
{
string Coord = RST.Fields["the_geom"].Value.ToString();
int Len = Coord.Length;
Coord = Right(Coord, (Len - 14));
Len = Coord.Length;
Coord = Mid(Coord, 0, (Len - 1));
char[] SepChar = { ' ' };
Array coordArray = Coord.Split(SepChar);
double xlon = Convert.ToDouble(coordArray.GetValue(0).ToString());
double xlat = Convert.ToDouble(coordArray.GetValue(1).ToString());
Position PoiY = new Position();
PoiY.X = xlat; PoiY.Y = xlon;
Calculations calc = new Calculations();
double xLen = calc.CalculateDistace(PoiX, PoiY);
//MessageBox.Show(xLen.ToString());
if (xLen < tempLen)
{
tempLen = xLen;
tempTown = RST.Fields["name"].Value.ToString();
}
//PoiY = null;
coordArray = null;
RST.MoveNext();
}
RST.Close();
RST = null;
}
if (tempLen != 1000000)
{
string retVal = Decimal.Round((decimal)tempLen, 3).ToString();
return retVal + "Km From " + tempTown;
}
else
{
return " ";
}
}
catch (System.Exception qw) { return " "; }
}
示例6: getRoadName
public string getRoadName()
{
try
{
Position PoiX = new Position();
PoiX.X = Lat; PoiX.Y = Lon;
double tempLen = 1000000;
string tempTown = "";
ADODB.Recordset RST = new ADODB.Recordset();
/* string sqlSTR = "SELECT name,the_geom FROM " + this.roadsTableName +" WHERE the_geom && 'BOX3D(" +
(Lon - 0.1) + " " + (Lat - 0.1) + "," + (Lon + 0.1) + " " + (Lat + 0.1) +
") '::box3d AND distance( the_geom, GeometryFromText( 'POINT(" + Lon + " " + Lat +
")', -1 ) ) < 0.11";
string sqlSTROther = "SELECT name,the_geom FROM " + this.roadsTableName + " WHERE the_geom && 'BOX3D(" +
(Lon - 1) + " " + (Lat - 1) + "," + (Lon + 1) + " " + (Lat + 1) +
") '::box3d AND distance( the_geom, GeometryFromText( 'POINT(" + Lon + " " + Lat +
")', -1 ) ) < 1.1";*/
string sqlSTR = "SELECT rd_name,the_geom FROM kRoads WHERE the_geom && 'BOX3D(" +
(Lon - 0.1) + " " + (Lat - 0.1) + "," + (Lon + 0.1) + " " + (Lat + 0.1) +
") '::box3d AND distance( the_geom, GeometryFromText( 'POINT(" + Lon + " " + Lat +
")', -1 ) ) < 0.11";
string sqlSTROther = "SELECT rd_name,the_geom FROM kRoads WHERE the_geom && 'BOX3D(" +
(Lon - 1) + " " + (Lat - 1) + "," + (Lon + 1) + " " + (Lat + 1) +
") '::box3d AND distance( the_geom, GeometryFromText( 'POINT(" + Lon + " " + Lat +
")', -1 ) ) < 1.1";
RST.Open(sqlSTR, this.odbcDatabaseConnection, ADODB.CursorTypeEnum.adOpenDynamic,
ADODB.LockTypeEnum.adLockBatchOptimistic, 0);
if (RST.EOF == true)
{
try { RST.Close(); }
catch { }
RST.Open(sqlSTROther, this.odbcDatabaseConnection, ADODB.CursorTypeEnum.adOpenDynamic,
ADODB.LockTypeEnum.adLockBatchOptimistic, 0);
}
if (RST.EOF == false)
{
RST.MoveFirst();
while (RST.EOF == false)
{
/*we are no longer dealing with a single point we are
* dealind with a line string*/
string Coord = RST.Fields["the_geom"].Value.ToString();
int Len = Coord.Length;
Coord = Right(Coord, (Len - 25));
Len = Coord.Length;
Coord = Mid(Coord, 0, (Len - 2));
char[] SepChar = { ',' };
Array pointArray = Coord.Split(SepChar);
/*lets loop through the line string*/
for (int p = 0; p < pointArray.Length; p++)
{
try
{
char[] pointSep = { ' ' };
Array coordArray = pointArray.GetValue(p).ToString().Split(pointSep);
double xlon = Convert.ToDouble(coordArray.GetValue(0).ToString());
double xlat = Convert.ToDouble(coordArray.GetValue(1).ToString());
Position PoiY = new Position();
PoiY.X = xlat; PoiY.Y = xlon;
Calculations calc = new Calculations();
double xLen = 10000001;
try { xLen = calc.CalculateDistace(PoiX, PoiY); }
catch { }
calc = null;
//MessageBox.Show(xLen.ToString());
if (xLen < tempLen)
{
tempLen = xLen;
if (tempLen > 0.5)
{ tempTown = " Along Unknown Road"; }
else
{ tempTown = " Along " + RST.Fields["rd_name"].Value.ToString(); }
}
//PoiY = null;
coordArray = null;
//Application.DoEvents();
}
catch { }
}
//Application.DoEvents();
RST.MoveNext();
}
RST.Close();
RST = null;
}
if (tempLen != 1000000)
{
//.........这里部分代码省略.........
示例7: ExportToCSV
public void ExportToCSV(bool PrintHeader = true)
{
string ExportFilePath = null;
ADODB.Recordset rs = default(ADODB.Recordset);
int i = 0;
int TotalRecords = 0;
bool ErrorOccured = false;
short NumberOfFields = 0;
const string quote = "\"";
//Faster then Chr$(34)
string sql = null;
Scripting.FileSystemObject fso = new Scripting.FileSystemObject();
cmdStart.Enabled = false;
cmdExit.Enabled = false;
txtPassword.Enabled = false;
string ptbl = null;
string t_day = null;
string t_Mon = null;
if (Strings.Len(Strings.Trim(Conversion.Str(DateAndTime.Day(DateAndTime.Today)))) == 1)
t_day = "0" + Strings.Trim(Convert.ToString(DateAndTime.Day(DateAndTime.Today)));
else
t_day = Convert.ToString(DateAndTime.Day(DateAndTime.Today));
if (Strings.Len(Strings.Trim(Conversion.Str(DateAndTime.Month(DateAndTime.Today)))) == 1)
t_Mon = "0" + Strings.Trim(Convert.ToString(DateAndTime.Month(DateAndTime.Today)));
else
t_Mon = Conversion.Str(DateAndTime.Month(DateAndTime.Today));
ExportFilePath = modRecordSet.serverPath + "4POSDebtor" + Strings.Trim(Convert.ToString(DateAndTime.Year(DateAndTime.Today))) + Strings.Trim(t_Mon) + Strings.Trim(t_day);
if (fso.FileExists(ExportFilePath + ".csv"))
fso.DeleteFile((ExportFilePath + ".csv"));
rs = modRecordSet.getRS(ref "SELECT CustomerID, Customer_InvoiceName, Customer_DepartmentName, Customer_FirstName, Customer_Surname, Customer_PhysicalAddress, Customer_PostalAddress, Customer_Telephone, Customer_Current as CurrentBalance,Customer_30Days as 30Days, Customer_60Days as 60days, Customer_90Days as 90Days, Customer_120Days as 120Days,Customer_150Days as 150Days FROM Customer");
prgBar.Maximum = rs.RecordCount;
if (rs.RecordCount > 0) {
FileSystem.FileOpen(1, ExportFilePath + ".csv", OpenMode.Output);
var _with2 = modRecordSet.getRS(ref ref "SELECT CustomerID, Customer_InvoiceName, Customer_DepartmentName, Customer_FirstName, Customer_Surname, Customer_PhysicalAddress, Customer_PostalAddress, Customer_Telephone, Customer_Current as CurrentBalance,Customer_30Days as 30Days, Customer_60Days as 60days, Customer_90Days as 90Days, Customer_120Days as 120Days,Customer_150Days as 150Days FROM Customer");
rs.MoveFirst();
NumberOfFields = rs.Fields.Count - 1;
if (PrintHeader) {
//Now add the field names
for (i = 0; i <= NumberOfFields - 1; i++) {
FileSystem.Print(1, rs.Fields(i).name + ",");
//similar to the ones below
}
FileSystem.PrintLine(1, rs.Fields(NumberOfFields).name);
}
while (!rs.EOF) {
prgBar.Value = prgBar.Value + 1;
// ERROR: Not supported in C#: OnErrorStatement
TotalRecords = TotalRecords + 1;
//If there is an emty field,
for (i = 0; i <= NumberOfFields; i++) {
//add a , to indicate it is
if ((Information.IsDBNull(rs.Fields(i).Value))) {
FileSystem.Print(1, ",");
//empty
} else {
if (i == NumberOfFields) {
FileSystem.Print(1, quote + Strings.Trim(Convert.ToString(rs.Fields(i).Value)) + quote);
} else {
FileSystem.Print(1, quote + Strings.Trim(Convert.ToString(rs.Fields(i).Value)) + quote + ",");
}
}
//Putting data under "" will not
}
//confuse the reader of the file
DoEventsEx();
//between Dhaka, Bangladesh as two
FileSystem.PrintLine(1);
//fields or as one field.
rs.moveNext();
}
FileSystem.FileClose(1);
Interaction.MsgBox("Customer details were successfully exported to : " + FilePath + "" + "4POSProd" + Strings.Trim(Convert.ToString(DateAndTime.Year(DateAndTime.Today))) + Strings.Trim(t_Mon) + Strings.Trim(t_day) + ".csv", MsgBoxStyle.OkOnly, "Customers");
// DoEvents
// DoEvents
// MsgBox "Now Zeroising...", vbOKOnly, "Customers"
// cmdStart.Enabled = False
// cmdExit.Enabled = False
// Set rsZ = getRS("SELECT CustomerID FROM Customer")
// Do While Not rsZ.EOF
// DoEvents
// cmdProcess_Click (rsZ("CustomerID"))
// DoEvents
// rsZ.moveNext
// Loop
//.........这里部分代码省略.........
示例8: CalcIntPeriod
public object CalcIntPeriod()
{
// ERROR: Not supported in C#: OnErrorStatement
double IntFromPeriod = 0;
double HoldTheSum = 0;
string TSum = null;
string CDateN = null;
string HoldVer = null;
string CmsBOx = null;
ADODB.Recordset rs = default(ADODB.Recordset);
rs = modRecordSet.getRS(ref "select * from Company");
modApplication.IntPeriod = rs.Fields("Company_IntPeriod").Value;
modApplication.Intpercen = rs.Fields("Company_IntPercent").Value;
if (!string.IsNullOrEmpty(modApplication.IntPeriod) & modApplication.Intpercen != 0) {
if (Interaction.MsgBox("This will calculate interest Percentage of " + "'" + modApplication.Intpercen + "%' " + " from " + "'" + modApplication.IntPeriod + "'" + " on your Overdue accounts are you sure you want to continue", MsgBoxStyle.YesNo, "4Pos Interest Calculation") == MsgBoxResult.Yes) {
//If vbYes Then
CDateN = Strings.Format(DateAndTime.Today);
adoPrimaryRS = modRecordSet.getRS(ref "select * from Customer");
if (modApplication.IntPeriod == "Current") {
adoPrimaryRS.MoveFirst();
while (!(adoPrimaryRS.EOF)) {
HoldTheSum = (adoPrimaryRS.Fields("Customer_Current").Value + adoPrimaryRS.Fields("Customer_30Days").Value + adoPrimaryRS.Fields("Customer_60Days").Value + adoPrimaryRS.Fields("Customer_90Days").Value + adoPrimaryRS.Fields("Customer_120Days").Value + adoPrimaryRS.Fields("Customer_150Days").Value);
if (HoldTheSum > 0) {
//Calculate interest
IntFromPeriod = (HoldTheSum * modApplication.Intpercen / 100) / 12;
TSum = Convert.ToString(IntFromPeriod + HoldTheSum);
//cnnDB.Execute "INSERT INTO Interest (CustomerID,Perc,Period,CDate,Description,Debit,Credit,SumIntBal)VALUES ('" & adoPrimaryRS("CustomerID") & "','" & Intpercen & "%" & "','" & IntPeriod & "','" & CDateN & "',' Interest ','" & IntFromPeriod & "','" & 0 & " ','" & TSum & "')"
System.Windows.Forms.Application.DoEvents();
cmdProcess_Click(ref adoPrimaryRS.Fields("CustomerID"), ref IntFromPeriod);
System.Windows.Forms.Application.DoEvents();
}
adoPrimaryRS.moveNext();
}
} else if (modApplication.IntPeriod == "30 Days") {
adoPrimaryRS.MoveFirst();
while (!(adoPrimaryRS.EOF)) {
HoldTheSum = adoPrimaryRS.Fields("Customer_30Days").Value + adoPrimaryRS.Fields("Customer_60Days").Value + adoPrimaryRS.Fields("Customer_90Days").Value + adoPrimaryRS.Fields("Customer_120Days").Value + adoPrimaryRS.Fields("Customer_150Days").Value;
if (HoldTheSum > 0) {
//Calculate interest
IntFromPeriod = (HoldTheSum * modApplication.Intpercen / 100) / 12;
TSum = Convert.ToString(IntFromPeriod + HoldTheSum);
//cnnDB.Execute "INSERT INTO Interest (CustomerID,Perc,Period,CDate,Description,Debit,Credit,SumIntBal)VALUES ('" & adoPrimaryRS("CustomerID") & "','" & Intpercen & "%" & "','" & IntPeriod & "','" & CDateN & "',' Interest ','" & IntFromPeriod & "','" & 0 & " ','" & TSum & "')"
System.Windows.Forms.Application.DoEvents();
cmdProcess_Click(ref adoPrimaryRS.Fields("CustomerID"), ref IntFromPeriod);
System.Windows.Forms.Application.DoEvents();
}
adoPrimaryRS.moveNext();
}
} else if (modApplication.IntPeriod == "60 Days") {
adoPrimaryRS.MoveFirst();
while (!(adoPrimaryRS.EOF)) {
HoldTheSum = adoPrimaryRS.Fields("Customer_60Days").Value + adoPrimaryRS.Fields("Customer_90Days").Value + adoPrimaryRS.Fields("Customer_120Days").Value + adoPrimaryRS.Fields("Customer_150Days").Value;
if (HoldTheSum > 0) {
//Calculate interest
IntFromPeriod = (HoldTheSum * modApplication.Intpercen / 100) / 12;
TSum = Convert.ToString(IntFromPeriod + HoldTheSum);
//cnnDB.Execute "INSERT INTO Interest (CustomerID,Perc,Period,CDate,Description,Debit,Credit,SumIntBal)VALUES ('" & adoPrimaryRS("CustomerID") & "','" & Intpercen & "%" & "','" & IntPeriod & "','" & CDateN & "',' Interest ','" & IntFromPeriod & "','" & 0 & " ','" & TSum & "')"
System.Windows.Forms.Application.DoEvents();
cmdProcess_Click(ref adoPrimaryRS.Fields("CustomerID"), ref IntFromPeriod);
System.Windows.Forms.Application.DoEvents();
}
adoPrimaryRS.moveNext();
}
} else if (modApplication.IntPeriod == "90 Days") {
adoPrimaryRS.MoveFirst();
while (!(adoPrimaryRS.EOF)) {
HoldTheSum = adoPrimaryRS.Fields("Customer_90Days").Value + adoPrimaryRS.Fields("Customer_120Days").Value + adoPrimaryRS.Fields("Customer_150Days").Value;
if (HoldTheSum > 0) {
//Calculate interest
IntFromPeriod = (HoldTheSum * modApplication.Intpercen / 100) / 12;
TSum = Convert.ToString(IntFromPeriod + HoldTheSum);
//cnnDB.Execute "INSERT INTO Interest (CustomerID,Perc,Period,CDate,Description,Debit,Credit,SumIntBal)VALUES ('" & adoPrimaryRS("CustomerID") & "','" & Intpercen & "%" & "','" & IntPeriod & "','" & CDateN & "',' Interest ','" & IntFromPeriod & "','" & 0 & " ','" & TSum & "')"
//.........这里部分代码省略.........
示例9: cmdSave_Click
private void cmdSave_Click(System.Object eventSender, System.EventArgs eventArgs)
{
// ERROR: Not supported in C#: OnErrorStatement
ADODB.Recordset rs = default(ADODB.Recordset);
ADODB.Recordset rst = default(ADODB.Recordset);
short RecSel1 = 0;
string TheSpacess = null;
string MyLines = null;
rs = new ADODB.Recordset();
rst = new ADODB.Recordset();
ADODB.Recordset rsMax = default(ADODB.Recordset);
short ThePosition = 0;
short TheCode = 0;
ADODB.Recordset rsDet = default(ADODB.Recordset);
rsMax = new ADODB.Recordset();
rsDet = new ADODB.Recordset();
//If Not IsNumeric(Me.txtpos.Text) Then
// MsgBox "Row Position Must be a Number.", vbInformation, "4Pos Back Office"
//Exit Sub
//Else
//End If
//for a sample of the selected field
//Designing barcodes
if (modApplication.TheNames == "Price") {
TheSpacess = "R 21.99";
//And rsT.RecordCount < 1 Then
if (_chkFields_4.CheckState == 1) {
if (this._chkFields_0.CheckState == 1) {
rs = modRecordSet.getRS(ref "INSERT INTO BClabelItem(BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + modApplication.RecSel + "," + this.txtpos.Text + ",'" + modApplication.TheNames + "'," + modApplication.MyFAlign + "," + this.cmbfont.Text + ",'" + 1 + "','" + TheSpacess + "','" + 0 + "'," + modApplication.MyLIDWHole + " )");
rsDet = modRecordSet.getRS(ref "SELECT Max(BClabelItem.BClabelItemID) as TheLastDe FROM BClabelItem");
rs = modRecordSet.getRS(ref "INSERT INTO BClabelItemUndo(BClabelItemID,BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + rsDet.Fields("TheLastDe").Value + "," + modApplication.RecSel + "," + this.txtpos.Text + ",'" + modApplication.TheNames + "'," + modApplication.MyFAlign + "," + this.cmbfont.Text + ",'" + 1 + "','" + TheSpacess + "','" + 0 + "'," + modApplication.MyLIDWHole + ")");
} else {
rs = modRecordSet.getRS(ref "INSERT INTO BClabelItem(BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + modApplication.RecSel + "," + this.txtpos.Text + ",'" + modApplication.TheNames + "'," + modApplication.MyFAlign + "," + this.cmbfont.Text + ",'" + 0 + "','" + TheSpacess + "','" + 0 + "'," + modApplication.MyLIDWHole + " )");
rsDet = modRecordSet.getRS(ref "SELECT Max(BClabelItem.BClabelItemID) as TheLastDe FROM BClabelItem");
rs = modRecordSet.getRS(ref "INSERT INTO BClabelItemUndo(BClabelItemID,BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + rsDet.Fields("TheLastDe").Value + "," + modApplication.RecSel + "," + this.txtpos.Text + ",'" + modApplication.TheNames + "'," + modApplication.MyFAlign + "," + this.cmbfont.Text + ",'" + 0 + "','" + TheSpacess + "','" + 0 + "'," + modApplication.MyLIDWHole + ")");
}
//ElseIf _chkFields_4.value = 1 And rsT.RecordCount > 0 Then
//Set rs = getRS("UPDATE BClabelItem SET BClabelItem_Line=" & ThePosition & ",BClabelItem_Field='" & TheNames & "',BClabelItem_Align=" & MyFAlign & ",BClabelItem_Size=" & Me.cmbfont.Text & ",BClabelItem_Sample='" & TheSpacess & "',BClabelItem_Disabled='" & 0 & "' WHERE BClabelItem_BCLabelID=" & RecSel & " AND BClabelItem_Field='" & TheNames & "'")
} else if (_chkFields_4.CheckState == 0) {
//Set rsDet = getRS("SELECT Max(BClabelItem.BClabelItemID) as TheLastDe FROM BClabelItem")
rsDet = modRecordSet.getRS(ref "SELECT * FROM BClabelItem WHERE BClabelItem_BCLabelID=" + modApplication.RecSel + " AND BClabelItem_Field='" + modApplication.TheNames + "'");
rsDet.MoveFirst();
rs = modRecordSet.getRS(ref "INSERT INTO BClabelItemUndo(BClabelItemID,BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + rsDet.Fields("BClabelItemID").Value + "," + modApplication.RecSel + "," + rsDet.Fields("BClabelItem_Line").Value + ",'" + modApplication.TheNames + "'," + rsDet.Fields("BClabelItem_Align").Value + "," + rsDet.Fields("BClabelItem_Size").Value + "," + rsDet.Fields("BClabelItem_Bold").Value + ",'" + TheSpacess + "'," + rsDet.Fields("BClabelItem_Disabled").Value + "," + modApplication.MyLIDWHole + ")");
rs = modRecordSet.getRS(ref "DELETE * FROM BClabelItem WHERE BClabelItem_BCLabelID=" + modApplication.RecSel + " AND BClabelItem_Field='" + modApplication.TheNames + "' and BClabelItemID=" + rsDet.Fields("BClabelItemID").Value + "");
}
//Designing barcodes
} else if (modApplication.TheNames == "Price6") {
TheSpacess = "R 21.99 for 6";
//And rsT.RecordCount < 1 Then
if (_chkFields_4.CheckState == 1) {
if (this._chkFields_0.CheckState == 1) {
rs = modRecordSet.getRS(ref "INSERT INTO BClabelItem(BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + modApplication.RecSel + "," + this.txtpos.Text + ",'" + modApplication.TheNames + "'," + modApplication.MyFAlign + "," + this.cmbfont.Text + ",'" + 1 + "','" + TheSpacess + "','" + 0 + "'," + modApplication.MyLIDWHole + " )");
rsDet = modRecordSet.getRS(ref "SELECT Max(BClabelItem.BClabelItemID) as TheLastDe FROM BClabelItem");
rs = modRecordSet.getRS(ref "INSERT INTO BClabelItemUndo(BClabelItemID,BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + rsDet.Fields("TheLastDe").Value + "," + modApplication.RecSel + "," + this.txtpos.Text + ",'" + modApplication.TheNames + "'," + modApplication.MyFAlign + "," + this.cmbfont.Text + ",'" + 1 + "','" + TheSpacess + "','" + 0 + "'," + modApplication.MyLIDWHole + ")");
} else {
rs = modRecordSet.getRS(ref "INSERT INTO BClabelItem(BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + modApplication.RecSel + "," + this.txtpos.Text + ",'" + modApplication.TheNames + "'," + modApplication.MyFAlign + "," + this.cmbfont.Text + ",'" + 0 + "','" + TheSpacess + "','" + 0 + "'," + modApplication.MyLIDWHole + " )");
rsDet = modRecordSet.getRS(ref "SELECT Max(BClabelItem.BClabelItemID) as TheLastDe FROM BClabelItem");
rs = modRecordSet.getRS(ref "INSERT INTO BClabelItemUndo(BClabelItemID,BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + rsDet.Fields("TheLastDe").Value + "," + modApplication.RecSel + "," + this.txtpos.Text + ",'" + modApplication.TheNames + "'," + modApplication.MyFAlign + "," + this.cmbfont.Text + ",'" + 0 + "','" + TheSpacess + "','" + 0 + "'," + modApplication.MyLIDWHole + ")");
}
//ElseIf _chkFields_4.value = 1 And rsT.RecordCount > 0 Then
//Set rs = getRS("UPDATE BClabelItem SET BClabelItem_Line=" & ThePosition & ",BClabelItem_Field='" & TheNames & "',BClabelItem_Align=" & MyFAlign & ",BClabelItem_Size=" & Me.cmbfont.Text & ",BClabelItem_Sample='" & TheSpacess & "',BClabelItem_Disabled='" & 0 & "' WHERE BClabelItem_BCLabelID=" & RecSel & " AND BClabelItem_Field='" & TheNames & "'")
} else if (_chkFields_4.CheckState == 0) {
//Set rsDet = getRS("SELECT Max(BClabelItem.BClabelItemID) as TheLastDe FROM BClabelItem")
rsDet = modRecordSet.getRS(ref "SELECT * FROM BClabelItem WHERE BClabelItem_BCLabelID=" + modApplication.RecSel + " AND BClabelItem_Field='" + modApplication.TheNames + "'");
rsDet.MoveFirst();
rs = modRecordSet.getRS(ref "INSERT INTO BClabelItemUndo(BClabelItemID,BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + rsDet.Fields("BClabelItemID").Value + "," + modApplication.RecSel + "," + rsDet.Fields("BClabelItem_Line").Value + ",'" + modApplication.TheNames + "'," + rsDet.Fields("BClabelItem_Align").Value + "," + rsDet.Fields("BClabelItem_Size").Value + "," + rsDet.Fields("BClabelItem_Bold").Value + ",'" + TheSpacess + "'," + rsDet.Fields("BClabelItem_Disabled").Value + "," + modApplication.MyLIDWHole + ")");
rs = modRecordSet.getRS(ref "DELETE * FROM BClabelItem WHERE BClabelItem_BCLabelID=" + modApplication.RecSel + " AND BClabelItem_Field='" + modApplication.TheNames + "' and BClabelItemID=" + rsDet.Fields("BClabelItemID").Value + "");
}
//Designing barcodes
} else if (modApplication.TheNames == "Price12") {
TheSpacess = "R 21.99 for 12";
//And rsT.RecordCount < 1 Then
if (_chkFields_4.CheckState == 1) {
if (this._chkFields_0.CheckState == 1) {
rs = modRecordSet.getRS(ref "INSERT INTO BClabelItem(BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + modApplication.RecSel + "," + this.txtpos.Text + ",'" + modApplication.TheNames + "'," + modApplication.MyFAlign + "," + this.cmbfont.Text + ",'" + 1 + "','" + TheSpacess + "','" + 0 + "'," + modApplication.MyLIDWHole + " )");
rsDet = modRecordSet.getRS(ref "SELECT Max(BClabelItem.BClabelItemID) as TheLastDe FROM BClabelItem");
rs = modRecordSet.getRS(ref "INSERT INTO BClabelItemUndo(BClabelItemID,BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + rsDet.Fields("TheLastDe").Value + "," + modApplication.RecSel + "," + this.txtpos.Text + ",'" + modApplication.TheNames + "'," + modApplication.MyFAlign + "," + this.cmbfont.Text + ",'" + 1 + "','" + TheSpacess + "','" + 0 + "'," + modApplication.MyLIDWHole + ")");
} else {
rs = modRecordSet.getRS(ref "INSERT INTO BClabelItem(BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + modApplication.RecSel + "," + this.txtpos.Text + ",'" + modApplication.TheNames + "'," + modApplication.MyFAlign + "," + this.cmbfont.Text + ",'" + 0 + "','" + TheSpacess + "','" + 0 + "'," + modApplication.MyLIDWHole + " )");
rsDet = modRecordSet.getRS(ref "SELECT Max(BClabelItem.BClabelItemID) as TheLastDe FROM BClabelItem");
rs = modRecordSet.getRS(ref "INSERT INTO BClabelItemUndo(BClabelItemID,BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + rsDet.Fields("TheLastDe").Value + "," + modApplication.RecSel + "," + this.txtpos.Text + ",'" + modApplication.TheNames + "'," + modApplication.MyFAlign + "," + this.cmbfont.Text + ",'" + 0 + "','" + TheSpacess + "','" + 0 + "'," + modApplication.MyLIDWHole + ")");
}
//ElseIf _chkFields_4.value = 1 And rsT.RecordCount > 0 Then
//Set rs = getRS("UPDATE BClabelItem SET BClabelItem_Line=" & ThePosition & ",BClabelItem_Field='" & TheNames & "',BClabelItem_Align=" & MyFAlign & ",BClabelItem_Size=" & Me.cmbfont.Text & ",BClabelItem_Sample='" & TheSpacess & "',BClabelItem_Disabled='" & 0 & "' WHERE BClabelItem_BCLabelID=" & RecSel & " AND BClabelItem_Field='" & TheNames & "'")
} else if (_chkFields_4.CheckState == 0) {
//Set rsDet = getRS("SELECT Max(BClabelItem.BClabelItemID) as TheLastDe FROM BClabelItem")
rsDet = modRecordSet.getRS(ref "SELECT * FROM BClabelItem WHERE BClabelItem_BCLabelID=" + modApplication.RecSel + " AND BClabelItem_Field='" + modApplication.TheNames + "'");
rsDet.MoveFirst();
rs = modRecordSet.getRS(ref "INSERT INTO BClabelItemUndo(BClabelItemID,BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + rsDet.Fields("BClabelItemID").Value + "," + modApplication.RecSel + "," + rsDet.Fields("BClabelItem_Line").Value + ",'" + modApplication.TheNames + "'," + rsDet.Fields("BClabelItem_Align").Value + "," + rsDet.Fields("BClabelItem_Size").Value + "," + rsDet.Fields("BClabelItem_Bold").Value + ",'" + TheSpacess + "'," + rsDet.Fields("BClabelItem_Disabled").Value + "," + modApplication.MyLIDWHole + ")");
//.........这里部分代码省略.........
示例10: cmdExit_Click
private void cmdExit_Click(System.Object eventSender, System.EventArgs eventArgs)
{
//On Error GoTo ErrH
ADODB.Recordset rs = default(ADODB.Recordset);
ADODB.Recordset rst = default(ADODB.Recordset);
ADODB.Recordset rsHave = default(ADODB.Recordset);
ADODB.Recordset rsMaxID = default(ADODB.Recordset);
short HoldBClabelItem_BCLabelID = 0;
string TheSample = null;
ADODB.Recordset rsInner = default(ADODB.Recordset);
short HoldLaIDVaBack = 0;
short TMaxID = 0;
rs = new ADODB.Recordset();
rst = new ADODB.Recordset();
rsHave = new ADODB.Recordset();
rsInner = new ADODB.Recordset();
rsMaxID = new ADODB.Recordset();
modApplication.IntDesign = 0;
//New code
rs = modRecordSet.getRS(ref "DELETE * FROM BClabelItemUndo");
strheight = 0;
strwidht = 0;
rs = modRecordSet.getRS(ref "SELECT * FROM LabelItem WHERE labelItem_LabelID=" + modApplication.MyLIDWHole + "");
if (rs.RecordCount == 1) {
rs = modRecordSet.getRS(ref "DELETE * FROM LabelItem WHERE labelItem_LabelID=" + modApplication.MyLIDWHole + "");
rs = modRecordSet.getRS(ref "DELETE * FROM Label WHERE LabelID=" + modApplication.MyLIDWHole + "");
rs = modRecordSet.getRS(ref "DELETE * FROM BClabel WHERE BClabel_LabelID=" + modApplication.MyLIDWHole + "");
rs = modRecordSet.getRS(ref "DELETE * FROM BClabelItem WHERE BClabelItem_LabelID=" + modApplication.MyLIDWHole + "");
this.Close();
My.MyProject.Forms.frmDesign.RefreshLoad(ref modApplication.TheType);
return;
} else {
}
rs = modRecordSet.getRS(ref "SELECT Max(LabelItem.labelItem_LabelID) as TheMaxID FROM LabelItem");
TMaxID = rs.Fields("TheMaxID").Value;
rs = modRecordSet.getRS(ref "SELECT * FROM LabelItem ORDER BY labelItem_LabelID");
rs.MoveFirst();
//Loading BClabelItem with Infor from LabelItem
while (!(rs.EOF)) {
// ERROR: Not supported in C#: OnErrorStatement
rsHave = modRecordSet.getRS(ref "SELECT * FROM BClabelItem WHERE BClabelItem_LabelID=" + rs.Fields("labelItem_LabelID").Value + "");
HoldBClabelItem_BCLabelID = rsHave.Fields("BClabelItem_BCLabelID").Value;
rst = modRecordSet.getRS(ref "DELETE * FROM BClabelItem WHERE BClabelItem_LabelID =" + rs.Fields("labelItem_LabelID").Value + "");
rsInner = modRecordSet.getRS(ref "SELECT * FROM LabelItem WHERE labelItem_LabelID=" + rs.Fields("labelItem_LabelID").Value + "");
while (!(rsInner.EOF)) {
if (Information.IsDBNull(rsInner.Fields("labelItem_Sample").Value)) {
TheSample = " ";
} else {
TheSample = rsInner.Fields("labelItem_Sample").Value;
}
rst = modRecordSet.getRS(ref "INSERT INTO BClabelItem(BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + HoldBClabelItem_BCLabelID + "," + rsInner.Fields("labelItem_Line").Value + ",'" + rsInner.Fields("labelItem_Field").Value + "'," + rsInner.Fields("labelItem_Align").Value + "," + rsInner.Fields("labelItem_Size").Value + "," + rsInner.Fields("labelItem_Bold").Value + ",'" + TheSample + "','" + 0 + "'," + rsInner.Fields("labelItem_LabelID").Value + ")");
rsInner.MoveNext();
}
HoldLaIDVaBack = rs.Fields("labelItem_LabelID").Value;
rs.MoveNext();
while (!(rs.Fields("labelItem_LabelID").Value != HoldLaIDVaBack)) {
if (rs.Fields("labelItem_LabelID").Value == TMaxID) {
rs.MoveLast();
rs.MoveNext();
break; // TODO: might not be correct. Was : Exit Do
}
rs.MoveNext();
}
}
this.Close();
My.MyProject.Forms.frmDesign.RefreshLoad(ref modApplication.TheType);
//ErrH: frmDesign.RefreshLoad TheType
//frmdesign.RefreshLoad TheType
}