我试图在VBA的表中运行这样的选择查询语句:
export class TodoRequest {
public static async getTodo(id: number): Promise<ITodo> {
const todo: ITodo = {} as ITodo;
const site: string = "https://jsonplaceholder.typicode.com/";
const query = "todos/" + id;
const res: superagent.Response = await TodoRequest.getRequest(site + query).catch((error) => {
if (error.message) {
todo.error = error.message;
}
if (error.status) {
todo.status = error.status;
}
todo.ok = false;
return todo;
});
if (res.status) {
todo.status = res.status;
}
if (res.ok) {
todo.ok = res.ok;
}
if (res.body) {
if (res.body.id) {
todo.id = res.body.id;
}
if (res.body.userId) {
todo.userId = res.body.userId;
}
if (res.body.title) {
todo.title = res.body.title;
}
if (res.body.completed) {
todo.completed = res.body.completed;
}
todo.ok = true;
}
return todo;
}
protected static getRequest(url: string): Promise<superagent.Response> {
return new Promise<superagent.Response>((resolve, reject) => {
superagent
.get(url)
.set("Content-Type", "application/json")
.end((err, res) => {
if (!err) {
resolve(res);
} else {
reject(err);
}
});
});
}
正确连接数据库后,查询如下:
variable_a = 1
variable_b = 2
但是失败。\
如何在两个或多个VBA变量语句之间使用“ AND”?它可以在一种情况下正常工作,但“ AND”或“ OR”部分会将其弄乱。
谢谢
尝试将查询分为几行:
SQry = "select CONCAT(Col1,Colb) as TOTAL from MyTable where Col1 = '" & variable_a & "' AND '" & variable_b & "'"