Hey everyone,
I am currently using Microsofts DataAccess Application
block ( SQLHelper ) and what I want to do is use a
parameterized query instead of just SQL. I can not use
stored procedures, I just want to create an sql statement
such as this:
Dim SelectStatement As String = _
"SELECT folder_id, " & _
"document, " & _
"doc_page, " & _
"user_id, " & _
"notes_date, " & _
"notes_access, " & _
"notes_title, " & _
"notes_text " & _
"FROM pwv_doc_notes_tbl " & _
"WHERE document = ? AND " & _
"folder_id = ? AND " & _
"(user_id = ? OR " & _
"notes_access <> 1 )"
And then create 3 parameters:
Dim Param1 As SQLDataParameter("Document", document)
Dim Param2 As SQLDataParameter("FolderId",folderId)
Dim Param3 As SQLDataParameter("UserId", userId)
And executeDataset:
Ds = SqlHelper.ExecuteDataset(CommandType.Text,
SelectStatement, Param1, Param2, Param3)
This doesn't work but I am new to parameterized queries so
I am curious if anyone can shed some light on what I am
doing wrong?
I appologize if this is unclear...
Thanks
Jorell 1 1984
Probably not the right group for this question, but here is an answer...
Instead of using the question mark, use a names T-SQL parameter. For
example:
string sql = "SELECT * FROM authors WHERE fname=@fname"
SqlParameter param = new SqlParameter( "@fname", "Peter" );
Etc...
--
----------------------------------------------------------------
Peter Provost
Weblog: http://www.peterprovost.org/
----------------------------------------------------------------
"Jorell" <an*******@discussions.microsoft.com> wrote in message
news:00****************************@phx.gbl... Hey everyone,
I am currently using Microsofts DataAccess Application block ( SQLHelper ) and what I want to do is use a parameterized query instead of just SQL. I can not use stored procedures, I just want to create an sql statement such as this: Dim SelectStatement As String = _ "SELECT folder_id, " & _ "document, " & _ "doc_page, " & _ "user_id, " & _ "notes_date, " & _ "notes_access, " & _ "notes_title, " & _ "notes_text " & _ "FROM pwv_doc_notes_tbl " & _ "WHERE document = ? AND " & _ "folder_id = ? AND " & _ "(user_id = ? OR " & _ "notes_access <> 1 )"
And then create 3 parameters: Dim Param1 As SQLDataParameter("Document", document) Dim Param2 As SQLDataParameter("FolderId",folderId) Dim Param3 As SQLDataParameter("UserId", userId)
And executeDataset: Ds = SqlHelper.ExecuteDataset(CommandType.Text, SelectStatement, Param1, Param2, Param3)
This doesn't work but I am new to parameterized queries so I am curious if anyone can shed some light on what I am doing wrong? I appologize if this is unclear... Thanks
Jorell This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: gary b |
last post by:
Hello
When I use a PreparedStatement (in jdbc) with the following query:
SELECT store_groups_id
FROM store_groups
WHERE store_groups_id IS NOT NULL
AND type = ?
ORDER BY group_name
|
by: shumaker |
last post by:
I have a form in an Access Project that displays some records, and
based on the displayed records I'd like to output this to an excel
file, but I need to write more fields of the record than are...
|
by: deko |
last post by:
I'm trying to open a Recordset based on a parameterized query. I'm kind of
new to parameterized queries, so I'm sure I'm missing something simple.
Set qdfs = db.QueryDefs
Set qdf =...
|
by: deko |
last post by:
Is it possible to build a parameterized query from another parameterized
query?
I've tried two variations of this and can't seem to get it to work (using
DAO). Any suggestions welcome!
I...
|
by: anony |
last post by:
Hello,
I can't figure out why my parameterized query from an ASP.NET page is
dropping "special" characters such as accented quotes & apostrophes, the
registered trademark symbol, etc. These...
|
by: JSheble |
last post by:
After building a parameterized ADO query, is there a method or a statement
where you could see the actual query, with the parameterized values
included??
--
Using Opera's revolutionary e-mail...
|
by: Roland Hall |
last post by:
In Access you use "*" + + "*", + can be replaced with &
Calling a parameterized query in Access requires % be used in place of *,
however, all that I have read show dynamic SQL passed to Access:
...
|
by: TF |
last post by:
This group came through for me last time so here we go again. My page
shows paint colors, brand name, product code, etc in a gridview with
the background matching the paint color. Several links on...
|
by: xlar54 |
last post by:
Is there a way to see the exact SQL being generated from a
parameterized query? I am using this technique but am getting some
strange SQL errors during execution and I would like to see the final...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |