Re: ADODC recordsource SQL

From: loadhigh (loadhigh_at_21cn.com)
Date: 02/23/04


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?
>



Relevant Pages

  • Re: Vista hosting XPe tools/db
    ... Are you running this script on the machine that actually has the SQL server ... machine hosting the database. ... i don't know if you can install a second instance of SQL ...
    (microsoft.public.windowsxp.embedded)
  • Re: ActiveX script works in DTS but not in job, why?
    ... Account that SQL Agent runs under and it is a Local Admin on the box. ... As another test I saved the script as a .vbs file and tried running it, ... Microsoft OLE DB Provider for SQL Server ... that would be since I need to be able to load DTS packages from either a SQL ...
    (microsoft.public.sqlserver.dts)
  • Re: Enterprise Manager Newbie Question
    ... a SQL backup is not a simple copy of the database files. ... Is it possible to write a script that one could run from a workstation and ...
    (microsoft.public.sqlserver.tools)
  • Re: Vista hosting XPe tools/db
    ... here's an alternative script using the Microsoft ADO as ... opposed to the SQL DMO - this should allow this script to work ... Microsoft Windows XP Embedded Test Team ... This posting is provided "AS IS" with no warranties, and confers no rights. ...
    (microsoft.public.windowsxp.embedded)
  • Re: SQL Security
    ... except I'm having problems making it work in a script. ... ;Set properties of DB objects and open connection to database ... > from Books Online (within the SQL Server program group): ... > communicate with SQL Server. ...
    (microsoft.public.sqlserver.server)