Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get the CurrentUser from accessdatabase to the .Net Application

Status
Not open for further replies.

namche

Programmer
Nov 20, 2002
2
US
I have a access database called Net.mdb and i am logging in this access database with following Dot Net connectionstring with no problem...

"Provider=Microsoft.Jet.OLEDB.4.0; Data
Source=C:\Shared\NetAccessDatabase\Net.mdb;user
id=SYSTM;Password=tmsa;Jet OLEDB:System
database=c:\Winnt\system32\system.mdw;"

and then i am trying to open a query called vtblDefaultSegment in access database..Code in vtblDefaultSegment is as follows:-

SELECT [IDSegment]
FROM tblTMSGroups
WHERE GroupID=CurrentUser;

The sSQL statement is as follows going to the database...

sSQL = "select * from vtblDefaultSegment"

Calling function OpeniTMSDataset to open the dataset is as follows...

Shared Function OpeniTMSDataset(ByRef rsRecordSet As DataSet, ByVal sSQL As String, ByVal sConnectionString As String, Optional ByVal iOpenOption As Integer = DBConst.tmsDBEdit) As Boolean
Dim objDA As OleDb.OleDbDataAdapter
On Error GoTo ERRORHANDLER

objDA = New OleDb.OleDbDataAdapter(sSQL, sConnectionString)
objDA.Fill(rsRecordSet)
objDA = Nothing
OpeniTMSDataset = True
Exit Function

ERRORHANDLER:
u_errMessage = Err.Description
End Function

So, when i try to fill the DataSet with the record coming from vtblDefaultSegment i get an error message saying "No value given for one or more required parameters"..This message comes at objDA.Fill(rsRecordSet) line...I am thinking its because vtblDefaultSegment needs CurrentUser and i am not passing the CurrentUser from the application...Does anyone know how to pass the CurrentUser to access database...I would greatly appreciate....Thanks




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top