我确定这是相当明显的,对我而言,如果示例中的第二个双重问号是单个问号会更有意义。
来自他们的docs:
或者,您可以使用??字符作为您希望像这样转义的标识符的占位符:
var userId = 1;
var columns = ['username', 'email'];
var query = connection.query('SELECT ?? FROM ?? WHERE id = ?', [columns, 'users', userId], function(err, results) {
// ...
});
console.log(query.sql); // SELECT `username`, `email` FROM `users` WHERE id = 1
答案 0 :(得分:15)
// PhotoId is the network file path and name.
string photoId = "\\Photos\2015-May\390828d1-8f20-4fe9-9287-13d03894e9c0.jpg"
// Call to display the networked images.
lbl_images.Text += "<img src='" + this.PhotoBase64ImgSrc(photoId) + "' height='60px' width='60px' alt='photo' />";
// Supporting function that converts an image to base64.
protected string PhotoBase64ImgSrc(string fileNameandPath)
{
byte[] byteArray = File.ReadAllBytes(fileNameandPath);
string base64 = Convert.ToBase64String(byteArray);
return string.Format("data:image/gif;base64,{0}", base64);
}
用于表名和列名,它用反引号转义它们。 ??
用于普通值。