Click here to Skip to main content
15,897,273 members

Comments by badri2020 (Top 11 by date)

badri2020 30-Aug-10 8:21am View    
but it has not shown the error on lines wat you told...still there is error in verify function in application tier..still i cannot debug it
badri2020 30-Aug-10 7:57am View    
i>application tier:

Imports System.Data
Imports System.Data.SqlClient
Imports System.Security.Principal
Imports System.Threading
Imports System.IO
Imports System.Text
Imports System.Collections.Generic
Imports bal.cbal
Namespace app
End Namespace
Public Class capp
Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click
Dim verify As New bal.cbal
Dim dat As New bal.cbal
Dim use As String = UsernameTextBox.Text
Dim pas As String = PasswordTextBox.Text
verify(use, pas)
Me.Close()
End Sub
Private Sub Cancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel.Click
Me.Close()
End Sub
Private Sub capp_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'LoginDataSet.details' table. You can move, or remove it, as needed.
Me.DetailsTableAdapter.Fill(Me.LoginDataSet.details)
End Sub
End Class



business logic tier:


Imports System.Data
Imports System.Data.SqlClient
Imports System.Security.Principal
Imports System.Threading
Imports System.IO
Imports System.Text
Namespace cbal
Public Class bal
Dim check As New dal.cdal
Dim myDS As dal.cdal
Dim loginattempts As Integer
Public Function verify(ByVal use As String, ByVal pas As String) As String
If (use.Length > 10) Then
Throw New Exception("username must be atleast 10 characters")
ElseIf (pas.Length > 6) Then
Throw New Exception("password must be atleast 6 charcters long")
End If
loginattempts += 1
If loginattempts >= 3 Then
MsgBox("Too many failed login attempts", MsgBoxStyle.Exclamation)
Else
MsgBox("User Name not found. Please try again", MsgBoxStyle.Exclamation)
End If
Return myDS
End Function
End Class
End Namespace




data tier:

Imports System.Data
Imports System.Data.SqlClient
Imports System.Text
Imports System.Security.Principal
Imports System.Threading
Imports System.IO
Namespace dal
Public Class cdal
Dim strConnect As String = "Data Source=pc325;Initial Catalog=pubs;Integrated Security=SSPI;"
Dim Con As SqlConnection = New SqlConnection(strConnect)
Dim login As Object
Dim mySDA As Object
Dim myDS As Object
Sub Main()
Try
Con.Open()
Console.WriteLine("Connection Opened")
Catch ex As SqlException
Console.WriteLine("Error: " & ex.ToString())
Finally
Con.Close()
Console.WriteLine("Connection Closed")
End Try
End Sub
Public Function check(ByVal use As String, ByVal pas As String)
If (use = use And pas = pas) Then
Console.WriteLine("login success")
Else
Console.WriteLine("Invalid name/password")
End If
Dim com As New SqlCommand("select * from details where use ='" & use & "'pas ='" & pas & "'", Con)
Dim SqlDataAdapter As New mySDA
Dim mySDA As New SqlDataAdapter(login)
Dim DataSet As New myDS
mySDA.Fill(myDS) 'cmdObj.Dispose()
Con.Close()
Return myDS
End Function
Private Sub SqlDataAdapter(ByVal p1 As Object)
Throw New NotImplementedException
End Sub
End Class
End Namespace
k..
the error s coming in application tier..
it s giving the error on line 19 tat Class 'WindowsApplication2.bal.cbal' cannot be indexed because it has no default property
badri2020 30-Aug-10 7:54am View    
if i keep the end namespace atlast in the program it gives error in design..so only i hav written the code like that
badri2020 30-Aug-10 7:48am View    
Reason for my vote of 3
ghgh
badri2020 30-Aug-10 7:47am View    
i hav instantiated all classes with the new keyword...plz tell me on which line i ve to instantiate the class..i can't find wat u r telling