Print Page | Close Window

windows_auth

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: ASP.NET Discussion
Forum Description: Discussion and chat on ASP.NET related topics.
URL: https://forums.webwiz.net/forum_posts.asp?TID=9670
Printed Date: 28 March 2026 at 3:11pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: windows_auth
Posted By: pmkosana
Subject: windows_auth
Date 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





-------------
ALWAYZ SHINE ALONG THE WAY



Replies:
Posted By: Mart
Date Posted: 09 February 2004 at 2:50pm
That code is ASP.NET not ASP... And I don't understand what your asking.


Posted By: pmkosana
Date 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



-------------
ALWAYZ SHINE ALONG THE WAY


Posted By: Semikolon
Date 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



Posted By: michael
Date 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)

......




-------------
http://baumannphoto.com" rel="nofollow - Blog | http://mpgtracker.com" rel="nofollow - MPG Tracker


Posted By: michael
Date 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......

-------------
http://baumannphoto.com" rel="nofollow - Blog | http://mpgtracker.com" rel="nofollow - MPG Tracker


Posted By: pmormr
Date Posted: 09 February 2004 at 7:25pm
same here...

-------------
Paul A Morgan

http://www.pmorganphoto.com/" rel="nofollow - http://www.pmorganphoto.com/


Posted By: Leeb65
Date 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.

 



-------------
Lee

http://www.rheinsitemedia.de">


Posted By: pmkosana
Date Posted: 10 February 2004 at 5:11am

thank you Guzy and forgive me Mart

 

I was using dataReader for a substitute and it is commented ,but for now I"m using dataset

my code has no more errors but the dataset could not appear because of a datagrid error

can someone help,where can I put this try code for my datagrid

 

the error I get "'Login' is not a member of 'System.Data.DataSet'."

 

try

mydatagrid.datasource=DS.Login("Login1")

mydatagrid.databind()

catch ex as exception errorlabel.text=ex.message

end try

and It is inside my  module -method-function

 

 

thankx in advance



-------------
ALWAYZ SHINE ALONG THE WAY


Posted By: Leeb65
Date Posted: 10 February 2004 at 5:17am

txtID.DataBindings.Add(new System.Windows.Forms.Binding("Text", dsTemplate1, "Template.ID"));

This is my databinding in C#.

 



-------------
Lee

http://www.rheinsitemedia.de">


Posted By: Diep-Vriezer
Date Posted: 10 February 2004 at 9:00am

Datasource=Dataset.Tables("YourSQLTable").Rows(x).Collumn("S omeCollumn")

Or something like that. Idd, Login is not a sub function of Dataset..



-------------
Gone..


Posted By: pmkosana
Date Posted: 11 February 2004 at 7:28am

thank you for you advices

help me with the format

<code>

try

 mydatagrid.datasource=DS.Tables("tStudents")

mydatagrid.databind() catch ex as exception errorlabel.text=ex.message

end try

 

I still have a another problem of declaring an errorlabel ,can anyone tell me where can i declare it in my form of inside the fuction,and plz

</code>

thanks in advance



-------------
ALWAYZ SHINE ALONG THE WAY


Posted By: Diep-Vriezer
Date Posted: 11 February 2004 at 7:39am

Try this

Try

   mydatagrid.Datasource=DS.Tables("tStudents")

   mydatagrid.Databind()

Catch e As Exception

    errorlabel.text=e.message

End Try



-------------
Gone..



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net