Hello WebWiz
I would like some help ,I building an asp_application ,and it deals with windows_auth ,and I'm building with Visual Basic,I have a problem of
matching windows_auth credeterials with the one that I have in my sql table, I have a table (tstudents) with login (usernames),,I want a dynamic retrieval of records /rows for the user who logged in
I had a tried my own tricks ,but i havve problem with SQldataAdapter ,it cannot be coverted to sqlcommand
this is my code
<code>
Public Function login(ByVal login1 as string) as Dataset 'SqlDataReader
Dim myconnection as new sqlconnection("server=G103-TT03;database=CampusLANDB;Trusted _Connection=yes")
Dim mycommand as new sqlcommand ("Select* From tNics Where login1 Like @param1",myconnection)
Try
myconnection.open
'dim reader1 as SqlDataReader = mycommand.executereader()
'return reader1
dim ds as new dataset
dim adpt as new sqlDataAdapter
adpt.selectcommand = mycommand
adpt.fill("yourtablename", ds)
return ds
catch ex as sqlexception
throw new exception(ex.message)
return nothing
finally
myconnection.close
end try
End Function
put these codes in your UI:
try
MyDatagrid.DataSource = yourclassname.login("username")
MyDatagrid.DataBind()
catch ex as exception
errorlabel.text = ex.message
end try
</code>
thankx in advance
pmkosana