Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Dec 11, 2008 06:03 PM by hans_v
Member
28 Points
105 Posts
Dec 11, 2008 11:51 AM|LINK
Wanted to know How to excute a saved Query in Access. Do I just add excute string in the SQL string or is there Object in the Command to use to excute a Saved Query? Using VB.Net\Asp.net 3.5
All-Star
86795 Points
9644 Posts
Moderator
MVP
Dec 11, 2008 12:14 PM|LINK
See this article:
http://aspnet101.com/aspnet101/aspnet/codesample.aspx?code=oleDbSproc
Dec 11, 2008 04:56 PM|LINK
With Cmd .Connection=MyConn .CommandType=CommandType.StoredProcedure .CommandText = "[Category Sales for 1995]" end with ".CommandText" is where the stored Procedure is called? If so I have a Query named "GetList" Would I apply it liek this .CommandText = "[Getlist]"
Also for insertign values in a row would it be liek this? .CommandText = "[AddList 'Value1', 'Value2', 'Value3']"
35986 Points
6550 Posts
Dec 11, 2008 05:50 PM|LINK
xBoRISx ".CommandText" is where the stored Procedure is called? If so I have a Query named "GetList" Would I apply it liek this .CommandText = "[Getlist]"
".CommandText" is where the stored Procedure is called? If so I have a Query named "GetList" Would I apply it liek this .CommandText = "[Getlist]"
Correct...
xBoRISx Also for insertign values in a row would it be liek this? .CommandText = "[AddList 'Value1', 'Value2', 'Value3']"
No,
.CommandText = "[Addlist]" .Parameters.AddWithValue("field1", Value1) .Parameters.AddWithValue("field2", Value2) .Parameters.AddWithValue("field3", Value3)
Where the order of the parameters must be the same order as they appear in the Saved Query.
Dec 11, 2008 06:00 PM|LINK
Ohhhhh Nice. Much more clear now. Thanks guys for the help. [<:o)]
Dec 11, 2008 06:03 PM|LINK
Welcome...
For more information on parameters, read this, Except for the commandtext (which should be the name of the saved query), everything is the same!
xBoRISx
Member
28 Points
105 Posts
MS Access Saved Query
Dec 11, 2008 11:51 AM|LINK
Wanted to know How to excute a saved Query in Access. Do I just add excute string in the SQL string or is there Object in the Command to use to excute a Saved Query?
Using VB.Net\Asp.net 3.5
DarrellNorto...
All-Star
86795 Points
9644 Posts
Moderator
MVP
Re: MS Access Saved Query
Dec 11, 2008 12:14 PM|LINK
See this article:
http://aspnet101.com/aspnet101/aspnet/codesample.aspx?code=oleDbSproc
Darrell Norton's Blog
Please click "Mark as Answer" if this helped you.
xBoRISx
Member
28 Points
105 Posts
Re: MS Access Saved Query
Dec 11, 2008 04:56 PM|LINK
With Cmd
.Connection=MyConn
.CommandType=CommandType.StoredProcedure
.CommandText = "[Category Sales for 1995]"
end with
".CommandText" is where the stored Procedure is called? If so I have a Query named "GetList" Would I apply it liek this
.CommandText = "[Getlist]"
Also for insertign values in a row would it be liek this?
.CommandText = "[AddList 'Value1', 'Value2', 'Value3']"
hans_v
All-Star
35986 Points
6550 Posts
Re: MS Access Saved Query
Dec 11, 2008 05:50 PM|LINK
Correct...
No,
.CommandText = "[Addlist]"
.Parameters.AddWithValue("field1", Value1)
.Parameters.AddWithValue("field2", Value2)
.Parameters.AddWithValue("field3", Value3)
Where the order of the parameters must be the same order as they appear in the Saved Query.
xBoRISx
Member
28 Points
105 Posts
Re: MS Access Saved Query
Dec 11, 2008 06:00 PM|LINK
Ohhhhh Nice. Much more clear now. Thanks guys for the help. [<:o)]
hans_v
All-Star
35986 Points
6550 Posts
Re: MS Access Saved Query
Dec 11, 2008 06:03 PM|LINK
Welcome...
For more information on parameters, read this, Except for the commandtext (which should be the name of the saved query), everything is the same!