Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - windows_auth
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

windows_auth

 Post Reply Post Reply Page  12>
Author
pmkosana View Drop Down
Newbie
Newbie
Avatar

Joined: 09 February 2004
Location: Germany
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote pmkosana Quote  Post ReplyReply Direct Link To This Post Topic: windows_auth
    Posted: 09 February 2004 at 2:46pm

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



Back to Top
Mart View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2002
Status: Offline
Points: 2304
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mart Quote  Post ReplyReply Direct Link To This Post Posted: 09 February 2004 at 2:50pm
That code is ASP.NET not ASP... And I don't understand what your asking.
Back to Top
pmkosana View Drop Down
Newbie
Newbie
Avatar

Joined: 09 February 2004
Location: Germany
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote pmkosana Quote  Post ReplyReply Direct Link To This Post Posted: 09 February 2004 at 3:38pm

thank you mart

 

I have a sqlDB with table(that has a column name ('LOGIN')I want when the user login to my application,he/she 's records in the table with the same 'login(username)' that she/he sued to login,must be the olny one to appear in the datagrid ,he/she requested

 

thankx in advance

pmkosana

Back to Top
Semikolon View Drop Down
Senior Member
Senior Member


Joined: 09 September 2003
Location: Norway
Status: Offline
Points: 1718
Post Options Post Options   Thanks (0) Thanks(0)   Quote Semikolon Quote  Post ReplyReply Direct Link To This Post Posted: 09 February 2004 at 3:42pm

didnt you just post this in the guestbook support?

Please read the rules or your account may be suspended

Back to Top
michael View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
Post Options Post Options   Thanks (0) Thanks(0)   Quote michael Quote  Post ReplyReply Direct Link To This Post Posted: 09 February 2004 at 6:52pm

you are specifying a parameter @param in the query but do not define it anywhere.
Did you try something similar to

Dim mycommand as new sqlcommand ("Select* From tNics Where login1 Like @param1",myconnection)
mycommand.Paramters.Add(new SQLClient.SQLParameter("@param1", login1)

......


Back to Top
michael View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
Post Options Post Options   Thanks (0) Thanks(0)   Quote michael Quote  Post ReplyReply Direct Link To This Post Posted: 09 February 2004 at 6:54pm
just looked at it again (you code takes 2 looks :) ) why are you using a LIKE query anyway? I would not do it this way at all......
Back to Top
pmormr View Drop Down
Senior Member
Senior Member


Joined: 06 January 2003
Location: United States
Status: Offline
Points: 1479
Post Options Post Options   Thanks (0) Thanks(0)   Quote pmormr Quote  Post ReplyReply Direct Link To This Post Posted: 09 February 2004 at 7:25pm
same here...
Back to Top
Leeb65 View Drop Down
Groupie
Groupie


Joined: 05 December 2003
Location: Germany
Status: Offline
Points: 62
Post Options Post Options   Thanks (0) Thanks(0)   Quote Leeb65 Quote  Post ReplyReply Direct Link To This Post Posted: 10 February 2004 at 2:37am

ds must be a DataSet not a DataReader and use "=" NOT "LIKE".

Also it's easier to use ='" & <LoginName> & "'" instead of a parameter.

 



Edited by Leeb65
Lee


Back to Top
 Post Reply Post Reply Page  12>

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.