Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 230
  • Last Modified:

SQL database current record variable

I have a database .Net application based on an SQL server back-end. I can query the data from Access through ODBC quite successfully. Is there a way I can limit the data returned by my Access query to be the current record displayed in my .Net/SQL application? There must be a variable or function in the SQL database that points to the current record to be used for its own purposes that I could use. Something like SELECT SQLData FROM SQLTable WHERE SQLFilenumber = @currentrecord. I have looked in the database structure but can't find anything useful so it may be created dynamically by the client application. Any ideas?
0
jrobinsn
Asked:
jrobinsn
  • 4
  • 3
1 Solution
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
to know what the "current record" is you need to have a primary key field in the table.
also, please clarify what you understand under "current record"? I presume a row selected in a grid?
0
 
jrobinsnAuthor Commented:
Yes, there is a primary key in the database which is a standard data record number assigned automatically and it is used to relate to the other tables in the database.

By "current record" I simply mean the record currently displayed in the client application (it can only display one at a time). When you request reports from that application it shows related records from other tables based on the ident of the master record. It probably does this by assigning the ident to a variable so it can use a standard query. It is this varible that I want to identify and use in my external application.
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
so, you want in your application to "know" the ID of the selected record by another application?
0
Granular recovery for Microsoft Exchange

With Veeam Explorer for Microsoft Exchange you can choose the Exchange Servers and restore points you’re interested in, and Veeam Explorer will present the contents of those mailbox stores for browsing, searching and exporting.

 
jrobinsnAuthor Commented:
Yes, exactly. I am sure that there is something in the SQL database or (maybe the local client) that points to what I want.
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
the database cannot know where an application grid points to.
only with the help of the application itself, which would need to store the information somewhere, you could know...
I fear that what you are trying to achieve is not possible, likely.
especially if the application is multi-user, but all using the same login, for example.
0
 
jrobinsnAuthor Commented:
I fear you may be right. Probably the best that I can hope for is to build an Acces form to sit alongside the .Net client application and have the user re-enter the filename into the Access form manually so that the output is restricted to the record that matches. Very tacky - but effective.

I understand that the server end will not be tracking the current record for all users but the client end must be. Maybe the developer can be convinced to place the record number as an "environment variable" (remember those - are they still around?) so that other applications can read it.

Thanks for your help.
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
0

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now