Re: ADODC recordsource SQL
From: loadhigh (loadhigh_at_21cn.com)
Date: 02/23/04
- Next message: anders: "error when logging in as user after SMS install of MDAC"
- Previous message: Neil Robbins: "Re: Problem changing password using ADOX.Catalog.Users(User).ChangePassword"
- In reply to: cellarstudio: "ADODC recordsource SQL"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 23 Feb 2004 21:49:41 +0800
Ok! It's no problem.
The script is answer to your frist question:
Adodc1.RecordSource = "SELECT * FROM VacationQuery WHERE UserID = '" &
g_strUser & "'"
Adodc1.Refresh
The second: The script could like below,
Adodc1.ConnectionString ="DSN=...;UserID=....;PWD=..."
Adodc1.RecordSource ="select ....."
Adodc1.Refresh
"cellarstudio" <anonymous@discussions.microsoft.com> дÈëÓʼþ
news:E4C9ECAA-C4DE-4E56-A5C2-14E66D221B4E@microsoft.com...
> I have an ADODC control on a form with a data grid. I have set the
connection to the DNS. When I set the record source to my access query, all
the records show up in the grid fine. But what I would like to do is set
the record source to the following SQL:
>
> SELECT * FROM VacationQuery WHERE UserID = '" & g_strUser & "'
>
> where g_strUser is a global variable that contains the userID of the
person that is currently logged into the program.
> I have a label at the top of the form that displays the contents of
g_strUser (on form Load), just to make sure variable works.
> When I use the SQL, the grid is empty, and is should be showing the
records of the user logged in.
>
> My first question is can you even use a variable in the sql of the
recordsource for an ADODC?
> Next questions..if I were to write code for the connection and sql
(instead of using the ADODC tool and setting the properties), where does
that code go? on form load?
>
- Next message: anders: "error when logging in as user after SMS install of MDAC"
- Previous message: Neil Robbins: "Re: Problem changing password using ADOX.Catalog.Users(User).ChangePassword"
- In reply to: cellarstudio: "ADODC recordsource SQL"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|