解释下 update LocksmithOrderProgress set DateCreated = dateadd(hh, -2, DateCreated) where OrderProgressStatus in (6, 11) and OrderID in (select Id from OrderInfo where PayOrderID = 主订单号)
时间: 2023-05-20 16:02:57 浏览: 50
这个 SQL 语句中有两个表:LocksmithOrderProgress 和 OrderInfo。它们之间有主外键关系,即 OrderInfo 表中的 Id 列是 LocksmithOrderProgress 表中的 OrderID 列的外键。
该语句的意思是:更新 LocksmithOrderProgress 表中 OrderProgressStatus 值为 6 或 11,并且 OrderID 在 OrderInfo 表中的 PayOrderID 等于指定值的行的 DateCreated 列。在更新时,DateCreated 将减去两小时。
具体来说,它会执行以下步骤:
1. 在 OrderInfo 表中查找 PayOrderID 等于指定值的行。
2. 在 LocksmithOrderProgress 表中查找 OrderProgressStatus 值为 6 或 11 且 OrderID 在 OrderInfo 表中找到的行的 Id 列中的值的行。
3. 对于 LocksmithOrderProgress 表中找到的行,更新它们的 DateCreated 列,使用 dateadd 函数将原有的 DateCreated 值减去两小时。
相关问题
vb6 编程修改文件创建时间,访问时间
在VB6编程中,要修改文件的创建时间和访问时间,可以使用文件系统对象(FileSystemObject)来实现。首先,需要引用Microsoft Scripting Runtime库以便能够使用文件系统对象。
接下来,可以使用FileSystemObject的GetFile方法来获取要修改的文件对象,然后通过文件对象的CreationDate属性和LastAccessDate属性来分别获取和设置文件的创建时间和访问时间。
下面是一个示例代码:
```vb
Dim fso As FileSystemObject
Dim file As Object
Set fso = New FileSystemObject
Set file = fso.GetFile("C:\path\to\file.txt")
' 修改文件的创建时间为当前时间
file.DateCreated = Now
' 修改文件的访问时间为指定时间
file.DateLastAccessed = #2022-01-01#
Set file = Nothing
Set fso = Nothing
```
上面的代码首先创建了一个文件系统对象并使用GetFile方法获取了要修改的文件对象。然后通过file对象的DateCreated属性和DateLastAccessed属性分别修改了文件的创建时间和访问时间。
需要注意的是,使用FileSystemObject需要保证系统中安装了Microsoft Scripting Runtime库,在VB6中可以通过在项目中引用该库来实现。
希望这些信息能够帮助到你,如果有其他问题,也欢迎继续问我。
设计Account1类,包含: ■ 一个名为id 的int 类型的私有数据域(默认值为0),长度为6位。 ■ 一个名为balance的double类型的私有数据域(默认值为0)。 ■ 一个名为annualInterestRate 的double类型的私有数据域存储当前利率(默认值为0)。假设所有的账户都有相同的利率。 ■ 一个名为dateCreated的Date类型的私有数据域存储账户的开户日期。 ■ 一个能创建默认账户的无参构造方法。 ■ 一个能创建带特定id和初始余额的构造方法,初始余额不能为负数。 ■ id、balance和annualInterestRate 的访问器和修改器。 ■ dateCreated的访问器。 ■ 一个名为getMonthlyInterestRate的方法返回月利率。 ■ 一个名为withDraw的方法从账户提取特定金额。 ■ 一个名为deposit的方法向账户存人特定金额。 ■ double类型的数据域保留2位小数。 ■ 成员方法和数据域应进行基本的合理性检查。 设计测试类ATMMachine1: ■ 创建一个有100个账户的数组,其id 为0,1,2,...99, 并初始化收支为1000美元。 ■ 主菜单如下: Main menu 1: check balance 2: withdraw 3: deposit 4: exit
下面是Account1类和ATMMachine1类的代码实现:
```
import java.util.Date;
public class Account1 {
private int id;
private double balance;
private double annualInterestRate;
private Date dateCreated;
public Account1() {
id = 0;
balance = 0;
annualInterestRate = 0;
dateCreated = new Date();
}
public Account1(int id, double balance) {
this.id = id;
if (balance >= 0) {
this.balance = balance;
} else {
System.out.println("Initial balance cannot be negative.");
this.balance = 0;
}
annualInterestRate = 0;
dateCreated = new Date();
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public double getBalance() {
return balance;
}
public void setBalance(double balance) {
this.balance = balance;
}
public double getAnnualInterestRate() {
return annualInterestRate;
}
public void setAnnualInterestRate(double annualInterestRate) {
this.annualInterestRate = annualInterestRate;
}
public Date getDateCreated() {
return dateCreated;
}
public double getMonthlyInterestRate() {
return annualInterestRate / 12;
}
public void withdraw(double amount) {
if (balance >= amount) {
balance -= amount;
} else {
System.out.println("Insufficient balance.");
}
}
public void deposit(double amount) {
if (amount >= 0) {
balance += amount;
} else {
System.out.println("Deposit amount cannot be negative.");
}
}
public String toString() {
return "Account ID: " + id + "\nBalance: $" + String.format("%.2f", balance) + "\nAnnual Interest Rate: " + annualInterestRate + "%\nDate Created: " + dateCreated;
}
}
import java.util.Scanner;
public class ATMMachine1 {
public static void main(String[] args) {
Account1[] accounts = new Account1[100];
for (int i = 0; i < accounts.length; i++) {
accounts[i] = new Account1(i, 1000);
}
Scanner input = new Scanner(System.in);
int choice = 0;
while (choice != 4) {
System.out.println("Main menu");
System.out.println("1: check balance");
System.out.println("2: withdraw");
System.out.println("3: deposit");
System.out.println("4: exit");
System.out.print("Enter a choice: ");
choice = input.nextInt();
switch (choice) {
case 1:
System.out.print("Enter an account ID (0-99): ");
int id = input.nextInt();
if (id >= 0 && id <= 99) {
System.out.println(accounts[id]);
} else {
System.out.println("Invalid account ID.");
}
break;
case 2:
System.out.print("Enter an account ID (0-99): ");
id = input.nextInt();
if (id >= 0 && id <= 99) {
System.out.print("Enter an amount to withdraw: ");
double amount = input.nextDouble();
accounts[id].withdraw(amount);
} else {
System.out.println("Invalid account ID.");
}
break;
case 3:
System.out.print("Enter an account ID (0-99): ");
id = input.nextInt();
if (id >= 0 && id <= 99) {
System.out.print("Enter an amount to deposit: ");
double amount = input.nextDouble();
accounts[id].deposit(amount);
} else {
System.out.println("Invalid account ID.");
}
break;
case 4:
System.out.println("Goodbye!");
break;
default:
System.out.println("Invalid choice.");
}
System.out.println();
}
}
}
```
这个程序创建了一个有100个账户的数组,初始收支为1000美元。主菜单提供了4个选项:检查余额、提取金额、存款和退出。用户可以根据需要选择相应的选项,对账户进行操作。每个账户都有一个6位的ID、余额和利率,以及一个开户日期。可以使用访问器和修改器来获取或设置这些值。程序还提供了getMonthlyInterestRate、withdraw和deposit等方法来计算月利率、提取特定金额和存入特定金额。这个程序还对输入进行了错误检查,确保提取金额不超过余额,存款金额不为负数,账户ID在0到99之间等。
相关推荐
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![apk](https://img-home.csdnimg.cn/images/20210720083646.png)