New To VB.net Need Help
-
Hello I am visual Basic 6 guy doing a project in VB.net now. Everything look different from visual basic 6 to .net. I need help in these things 1. I need to connect an odbc sql connection and how to set a public connection in module 2. what are the references i should have to add and how to add ( similar to how we add in vb 6) 3. Say i have a table called userTB and fields Usercode and userid and password. i need your help how to get these from the database and check and verify the username and password in a form called Login.vb If somebody can help me in this with coding and some descriptions then i can use that as a base and develop the applicaiton. Thanks and regards vimal Help in need is the help indeed
-
Hello I am visual Basic 6 guy doing a project in VB.net now. Everything look different from visual basic 6 to .net. I need help in these things 1. I need to connect an odbc sql connection and how to set a public connection in module 2. what are the references i should have to add and how to add ( similar to how we add in vb 6) 3. Say i have a table called userTB and fields Usercode and userid and password. i need your help how to get these from the database and check and verify the username and password in a form called Login.vb If somebody can help me in this with coding and some descriptions then i can use that as a base and develop the applicaiton. Thanks and regards vimal Help in need is the help indeed
It's not too late to redeem yourself. If you have the full VS.NET, just click on the C# project tab, and you can be saved... percyvimal wrote: I need to connect an odbc sql connection and how to set a public connection in module There are two groups of objects, if you're using SQL Server, then you want to open a System.Data.SqlClient.SqlConnection. percyvimal wrote: what are the references i should have to add and how to add ( similar to how we add in vb 6) System.Data. Anything else you need lives under there, and intellisense should reveal all. percyvimal wrote: Say i have a table called userTB and fields Usercode and userid and password. i need your help how to get these from the database and check and verify the username and password in a form called Login.vb Use a SqlCommand object ( same namespace as the connection ) to call the stored procedure that gives you this information. You're using a stored procedure, right ? Christian I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
-
It's not too late to redeem yourself. If you have the full VS.NET, just click on the C# project tab, and you can be saved... percyvimal wrote: I need to connect an odbc sql connection and how to set a public connection in module There are two groups of objects, if you're using SQL Server, then you want to open a System.Data.SqlClient.SqlConnection. percyvimal wrote: what are the references i should have to add and how to add ( similar to how we add in vb 6) System.Data. Anything else you need lives under there, and intellisense should reveal all. percyvimal wrote: Say i have a table called userTB and fields Usercode and userid and password. i need your help how to get these from the database and check and verify the username and password in a form called Login.vb Use a SqlCommand object ( same namespace as the connection ) to call the stored procedure that gives you this information. You're using a stored procedure, right ? Christian I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
Hello Mr Christian, Thanks for your reply.I am very very basic to vb.net and so i need more precise and elobarate descriptions with codings if possible. When i do this in vb6 this is how i do create a public connection in Public Db As Connection Sub Main() Set Db = New Connection Db.CursorLocation = adUseClient Db.Open "Provider=SQLOLEDB.1;Password=" & Password & ";Persist Security Info=True;User ID=" & userName & ";Initial Catalog= " & DataBaseName & " ;Data Source=" & ServerName & "" Frmlogin.Show 1 End Sub this is used in module. SO when i run the program it go to main function automatically. So how i do this in vb.net, same thing but how to do in vb.net Please explain to me in detail with codings and explain to me what referece to add and from where i have to add the reference. I am not using Stored procedure this is how i open a recordset using vb6 Dim Logrs as new recordset set Logrs= New recordset LogRs.Open "select [LoginID], [UserName],[password] from loginmaster where [UserName]='" & Trim(TxtUserName.Text) & "'", Db, adOpenDynamic, adLockOptimistic If LogRs.RecordCount <> 0 Then If LogRs.Fields("password") = Encrypt(Trim(txtnewPwod.Text)) Then LoginId = Val(LogRs.Fields("LoginID")) Unload Me Administrator = False FrmDonor.Show 1 Else MsgBox "Wrong password", vbCritical, App.ProductName Exit Function End If Else MsgBox "Username not exists", vbCritical, App.ProductName End If So how i can do this using vb.net, Thanks and regards vimal Help in need is the help indeed
-
Hello Mr Christian, Thanks for your reply.I am very very basic to vb.net and so i need more precise and elobarate descriptions with codings if possible. When i do this in vb6 this is how i do create a public connection in Public Db As Connection Sub Main() Set Db = New Connection Db.CursorLocation = adUseClient Db.Open "Provider=SQLOLEDB.1;Password=" & Password & ";Persist Security Info=True;User ID=" & userName & ";Initial Catalog= " & DataBaseName & " ;Data Source=" & ServerName & "" Frmlogin.Show 1 End Sub this is used in module. SO when i run the program it go to main function automatically. So how i do this in vb.net, same thing but how to do in vb.net Please explain to me in detail with codings and explain to me what referece to add and from where i have to add the reference. I am not using Stored procedure this is how i open a recordset using vb6 Dim Logrs as new recordset set Logrs= New recordset LogRs.Open "select [LoginID], [UserName],[password] from loginmaster where [UserName]='" & Trim(TxtUserName.Text) & "'", Db, adOpenDynamic, adLockOptimistic If LogRs.RecordCount <> 0 Then If LogRs.Fields("password") = Encrypt(Trim(txtnewPwod.Text)) Then LoginId = Val(LogRs.Fields("LoginID")) Unload Me Administrator = False FrmDonor.Show 1 Else MsgBox "Wrong password", vbCritical, App.ProductName Exit Function End If Else MsgBox "Username not exists", vbCritical, App.ProductName End If So how i can do this using vb.net, Thanks and regards vimal Help in need is the help indeed
I absolutely do not use VB, or VB.NET, my answer is based on my knowledge of the .NET framework. I suggest you look at the MSDN entries for the classes I pointed you to, they are bound to have a full example in VB.NET. And security that isn't locked down so it can only be accessed via a stored procedure is not remotely secure :-) Christian I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
-
I absolutely do not use VB, or VB.NET, my answer is based on my knowledge of the .NET framework. I suggest you look at the MSDN entries for the classes I pointed you to, they are bound to have a full example in VB.NET. And security that isn't locked down so it can only be accessed via a stored procedure is not remotely secure :-) Christian I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
Hi, I was wondering what you meant by "And security that isn't locked down so it can only be accessed via a stored procedure is not remotely secure"? Does that mean that stored procedures are more secure? and are they faster/give faster data retrieval results in large database applications?
-
Hi, I was wondering what you meant by "And security that isn't locked down so it can only be accessed via a stored procedure is not remotely secure"? Does that mean that stored procedures are more secure? and are they faster/give faster data retrieval results in large database applications?
Anonymous wrote: Does that mean that stored procedures are more secure? Absolutely. If your app uses plain SQL, then your user needs the right to arbitrarily execute SQL, which means that you open yourself to all sorts of attacks ( basically because the user has full access to the database ). If you use stored procedures, then give the user only the right to run a stored procedure, then they are unable to hack in a query that asks for all usernames and passwords, and instead can just run the stored procedure ( which returns true or false to a username/password combinatin passed in ). Anonymous wrote: are they faster/give faster data retrieval results in large database applications? Yes, because they are precompiled ( so long as they are properly written ) Christian I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
-
Hello I am visual Basic 6 guy doing a project in VB.net now. Everything look different from visual basic 6 to .net. I need help in these things 1. I need to connect an odbc sql connection and how to set a public connection in module 2. what are the references i should have to add and how to add ( similar to how we add in vb 6) 3. Say i have a table called userTB and fields Usercode and userid and password. i need your help how to get these from the database and check and verify the username and password in a form called Login.vb If somebody can help me in this with coding and some descriptions then i can use that as a base and develop the applicaiton. Thanks and regards vimal Help in need is the help indeed
Depending on the size of the project I almost always start out using the Data Access Application Block for .NET they are free and will save you a ton of work. It is a great starting point to both learn from and get in the right habits for writing good code. In VB 6 there were a lot of public connections used however in .Net you will find a more defined seperation between the datalayer and the rest of your application. ">href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/daab-rm.asp">[">^] Your question covers way to much to send in a message but let me try. In your case I would create a class objLogin, interface Ilogin, class dbLogin. Make the objLogin and dbLogin implement Ilogin that way they both have matching properties(this is the contract between objects) whenever you pass objLogin to dbLogin. The application block is your database class and is very generic so whenever you create an instance of it in your dbLogin class it will create a connection object and command object the dbLogin object uses to access the database. I know this all sounds absurd but I have not written a Data Access Object in over a year now. I don't have to since it is generic and reusable I use the same one over and over. As for the rest of the objects once you get the hang of it they are easy to do. I hope this helps point you in the right direction to find the answers you are looking for. Just remember to get the Data Access Application Blocks and hit a few articles on interfaces and you will be on your way. Oh yeah one more thing. Use Try Catch Finally in VB.net especially in your database classes or many bad things will happen to your app. Good Luck
-
Depending on the size of the project I almost always start out using the Data Access Application Block for .NET they are free and will save you a ton of work. It is a great starting point to both learn from and get in the right habits for writing good code. In VB 6 there were a lot of public connections used however in .Net you will find a more defined seperation between the datalayer and the rest of your application. ">href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/daab-rm.asp">[">^] Your question covers way to much to send in a message but let me try. In your case I would create a class objLogin, interface Ilogin, class dbLogin. Make the objLogin and dbLogin implement Ilogin that way they both have matching properties(this is the contract between objects) whenever you pass objLogin to dbLogin. The application block is your database class and is very generic so whenever you create an instance of it in your dbLogin class it will create a connection object and command object the dbLogin object uses to access the database. I know this all sounds absurd but I have not written a Data Access Object in over a year now. I don't have to since it is generic and reusable I use the same one over and over. As for the rest of the objects once you get the hang of it they are easy to do. I hope this helps point you in the right direction to find the answers you are looking for. Just remember to get the Data Access Application Blocks and hit a few articles on interfaces and you will be on your way. Oh yeah one more thing. Use Try Catch Finally in VB.net especially in your database classes or many bad things will happen to your app. Good Luck
Thanks Mr KevinMac The link u have given me was really useful. I think i have to be working on some oops concepts before going into .net. I used plain visual basic 6 and i found no difficulties in working with that.But when i started .net all look "Greek and Latin", and so i dont know where to start. Am i need to use modules and classes the same way i do it vb6 and same way for forms etc.. SO all these made me really confused and i searched for articles which will give me some ideas how to begin but nothing there for begginers like me. To be frank "In your case I would create a class objLogin, interface Ilogin, class dbLogin. Make the objLogin and dbLogin implement Ilogin that way they both have matching properties(this is the contract between objects) whenever you pass objLogin to dbLogin. " I couldnt able to understand what it actually means. So i expect a very basic level explanation, ( more like refering this from vb6 to vb.net mode) Thank you very much mate for you helps with regards vimal Help in need is the help indeed