![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Apr 2008
Posts: 11
Rep Power: 0
![]() |
Vb 2008 read/write from database mysql
hello the code down here works perfectly to connect to a mysql server.
but now i want it to read from it. so it can look that , lets say textbox2.text and textbox3.text are the same as in the database he will get acces to my program. and if its not the same then he wont get acces. Well i hope someone can help me , if u want me to be more specific just say it. (I am using vb 2008) |
|
|
|
|
|
#2 |
|
Newbie
Join Date: Apr 2008
Posts: 11
Rep Power: 0
![]() |
Re: Vb 2008 read/write from database mysql
So i added this code
Textbox1.text <- There should the account be typed in textbox2.text <- there should the password be typed in now i want it to see if textbox2.text(the password) is the same as in the database for textbox1.text(the account) i know it should be done with a query but i dont know how to use it so any help should be welcome. thx allot. Dim myadapter As New MySqlDataAdapter("Select * FROM accounts WHERE accounts.acc = textbox1.text", localMySqlConnection)
Dim dtset As New DataSet
myadapter.Fill(dtset)
myadapter.Dispose()
Dim table As DataTable = dtset.Tables(0) |
|
|
|
|
|
#3 |
|
Newbie
Join Date: Sep 2008
Posts: 1
Rep Power: 0
![]() |
Re: Vb 2008 read/write from database mysql
Personally for small queries I like to use the command object as well as the data reader. Here is a brief example only using the command object
Dim cmd As New MySqlCommand
Dim obj As New Object
cmd.Connection = localMySqlConnection
cmd.CommandText = "Select Count(acc) FROM accounts WHERE acc = textbox1.text"
obj = cmd.ExecuteScalar
If obj Is Nothing Then
' no match found
Else
' match found
End If |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Working with VB6 and MySQL database | Logical1 | Visual Basic | 5 | Jul 21st, 2008 9:55 AM |
| VB 2002 -> VB 2008 conversion | pal | Visual Basic .NET | 1 | Sep 15th, 2007 4:43 AM |
| mysql database search | programmingnoob | Other Scripting Languages | 6 | Jun 27th, 2007 6:55 PM |
| critical: pls help: MySql Database with ASP.NET and C# | paulchwd | ASP.NET | 1 | Apr 16th, 2007 4:51 AM |
| mySQL: Changing unique database to fulltext | BAS1X | PHP | 2 | Oct 24th, 2005 10:14 PM |