使用参数进行SELECT查询 [英] making a SELECT query with parameter

查看:137
本文介绍了使用参数进行SELECT查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Dim query As String =user1

Dim sqlQuery2 As String =SELECT * FROM'&query&'



ihave所有连接



如果我在SELECT

中输出一个参数名称,如果没有告诉我这可能会发生这种情况如何..

解决方案

从你发布的其他问题来看,你真的需要在继续之前学习SQL。您的SQL根本没有任何意义。



Sql教程 [ ^ ]

我知道Sql但是我问一个问题是否可以发生?


   -   您的格式为奇数, 
SELECT * FROM ' user1' - 不会返回任何内容。
- 你的select语句应该指向一个表,而不是一个字符串
SELECT * FROM [TableName] - 将返回指定表的所有条目
- 如果您有A列在该表的内部名为username,并且您想要用户名为user1的所有行,那么您应该将命令格式化为fallows。
SELECT * FROM [TableName] WHERE username = ' user1'


Dim query As String = "user1"
Dim sqlQuery2 As String = "SELECT * FROM '" & query & "'"

ihave all the connection

can this be happen if i make a parameter name an out it in the SELECT
if not show me how to..

解决方案

From the other questions you've posted, you REALLY need to learn SQL before continuing. Your SQL doesn't make any sense at all.

Sql Tutorials[^]


i know Sql but ive asking a question if it can be happen?


--Your format is odd, 
SELECT * FROM 'user1' --will not return anything.
--Your select statement should point to a table, not a string
SELECT * FROM [TableName]  --will return all entries of the specified table
--if you have A column inside of that table called username, and you want all rows where the username is user1 then you should format your command as fallows.
SELECT * FROM [TableName] WHERE username = 'user1'


这篇关于使用参数进行SELECT查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆