Answered by:
Using variables as in SQL queries for Access

Question
-
User904890884 posted
Hello,
I'm creating a site where someone logs in and can enter data that updates an Access database. I'm using formview for the data entry;
<asp:AccessDataSource ID="Description" runat="server" DataFile="~/App_Data/datanew.mdb" SelectCommand="SELECT CDescription FROM [Conference Details] WHERE (CID = 42346)" UpdateCommand="UPDATE [Conference Details] SET [Conference Details].CDescription=CDescriptionTextBox WHERE [Conference Details].CID=42346" SelectCommandType="Text"> </asp:AccessDataSource>
Is there an easier way to do this.
Any help whatsoever appreciated,
Thanks in advance.
Wednesday, January 28, 2009 1:59 PM
Answers
-
User-821857111 posted
Parameters: http://www.mikesdotnetting.com/Article.aspx?ArticleID=26
Actually, since you are using an AccessDataSource control, you will need to use one of the Parameter types that it supports. SessionParameter (http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.sessionparameter.aspx) is usually the way to go with logged in users. Where are you storing the CID value at the moment?
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Wednesday, January 28, 2009 4:08 PM -
User-1199946673 posted
Instead of a session parameter, you could also create a custom parameter:
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Wednesday, January 28, 2009 7:43 PM
All replies
-
User-821857111 posted
Parameters: http://www.mikesdotnetting.com/Article.aspx?ArticleID=26
Actually, since you are using an AccessDataSource control, you will need to use one of the Parameter types that it supports. SessionParameter (http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.sessionparameter.aspx) is usually the way to go with logged in users. Where are you storing the CID value at the moment?
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Wednesday, January 28, 2009 4:08 PM -
User904890884 posted
Thanks for reply Mike.
I'm pretty new to ASP and web development altogether. I think i can use that variable now.
Hadn't got as far as deciding about where to store CID. I was first worried how to get the Query going. At moment I just had CID's value in a label on the page.
Wednesday, January 28, 2009 7:39 PM -
User-1199946673 posted
Instead of a session parameter, you could also create a custom parameter:
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Wednesday, January 28, 2009 7:43 PM