# FBi's running SQL/VB help thread



## [I.R.A]_FBi (Aug 10, 2009)

Is xampp a good sql server?


----------



## Deleted member 3 (Aug 10, 2009)

It isn't an SQL server, it contains MySQL though, a very commonly used server.


----------



## [I.R.A]_FBi (Aug 10, 2009)

Ill take that as a kinda yes


----------



## FordGT90Concept (Aug 10, 2009)

MySQL is alright but not really suited for high-volume servers.  It doesn't have the refining and efficiency techniques seen in other databases like Oracle and MSSQL.

Edit: I'd say 90% of the time, MySQL is good enough (easier to install and configure too).


----------



## Deleted member 3 (Aug 10, 2009)

It's a yes. Many large sites and applications use it as backend, sure there are some fanboys who will tell you every SQL database on the planet should be Oracle, perhaps there is even some MSSQL fanboy and some geeks who swear Postegre is the way to go. MySQL is just fine though, and widely supported. If you require more than MySQL you'd know it already.


----------



## [I.R.A]_FBi (Aug 10, 2009)

Im planning to write a program that'd have around 3* 14 pc's on average running queries on a low volume basis that would be remote to the server (but in the same country) with around a query per minute per pc.


----------



## Deleted member 3 (Aug 10, 2009)

[I.R.A]_FBi said:


> Im planning to write a program that'd have around 3* 14 pc's on average running queries on a low volume basis that would be remote to the server (but in the same country) with around a query per minute per pc.



14 queries per minute should be nothing, unless tables get really big. I wouldn't worry.


----------



## [I.R.A]_FBi (Aug 10, 2009)

installed xammp and i got it up and used mysql query broswer and it seems working .. now to move to VB


----------



## [I.R.A]_FBi (Aug 12, 2009)

tryinta connect to an sql server which is currently local

i remmber this much 


```
Imports System.Data.SqlClient
Imports System.Configuration
Imports System.Configuration.ConfigurationSettings
```


----------



## FordGT90Concept (Aug 12, 2009)

http://www.connectionstrings.com/


----------



## [I.R.A]_FBi (Aug 13, 2009)

Im trying via this method ...


```
Imports System.Data.SqlClient
Public Class Form1 Inherits System.Windows.Forms.Form
Dim myConnection As SqlConnection
Dim myCommand As SqlCommand
Dim dr As New SqlDataReader()
'declaring the objects

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)_
Handles MyBase.Load
myConnection = New SqlConnection("server=localhost;uid=sa;pwd=;database=pubs")
'establishing connection. you need to provide password for sql server
Try
myConnection.Open()
'opening the connection
myCommand = New SqlCommand("Select * from discounts", myConnection)
'executing the command and assigning it to connection
dr = myCommand.ExecuteReader()
While dr.Read()
'reading from the datareader
MessageBox.Show("discounttype" & dr(0).ToString())
MessageBox.Show("stor_id" & dr(1).ToString())
MessageBox.Show("lowqty" & dr(2).ToString())
MessageBox.Show("highqty" & dr(3).ToString())
MessageBox.Show("discount" & dr(4).ToString())
'displaying the data from the table
End While
dr.Close()
myConnection.Close()
Catch e As Exception
End Try
End Sub

End Class
```

as per ...

im getting



```
Warning	2	Namespace or type specified in the Imports 'System.Data.SqlClient' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases.	C:\Documents and Settings\FBi\My Documents\Visual Studio 2008\Projects\TTS4\TTS4\TTSLogin.vb	1	9	TTS4
```

you guys are assuming i know a whole lot :|


----------



## Kreij (Aug 13, 2009)

Try using "Imports System.Data.Odbc"

Then try using OdbcConnection, OdbcDataAdapter and OdbcCommand

I had to use those to connect to a MySql DB here at work.

I also had to load the driver on my system.

My connection string looks like ...

DRIVER={MYSQL ODBC 3.51 Driver};SERVER=<IP address>; DATABASE=<database name>;UID=<uid>;PWD=<pw>

of course, don't use 3.51 in the string if you are using another version of the driver


----------



## [I.R.A]_FBi (Aug 16, 2009)

Kreij said:


> Try using "Imports System.Data.Odbc"
> 
> Then try using OdbcConnection, OdbcDataAdapter and OdbcCommand
> 
> ...



Tried it and i get 


```
Warning	2	Namespace or type specified in the Imports 'System.Data.Odbc' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases.	C:\Documents and Settings\FBi\My Documents\Visual Studio 2008\Projects\TTS4\TTS4\TTSLogin.vb	1	9	TTS4
```

Think ill have to go and look for one of my old lecturers, ill le tu guys know how it goes


----------



## Kreij (Aug 16, 2009)

Are the namespaces added as references to the project?
Look in Solution Explorer to see what references are added to the project.


----------



## [I.R.A]_FBi (Aug 16, 2009)

i see the option to add a reference. what should i add


----------



## Kreij (Aug 17, 2009)

The Odbc stuff should reside in the System.Data.Dll
If you already have a reference to System.Data then I'm a little stumped as why you cannot access the Odbc namespace (or the Sql ones either).


----------

