VB.NET - Need Help...about access database crossing intranet.

Asked By lee ray
28-Feb-07 02:41 PM
My project is Pc-Pc based karaoke system which involved intranet. Now, I have 2 parts. I have a host which posses of songs and database. And a client with GUI to connect to the host, access the database and then play the karaoke songs.
 
What I had done until now is I have a part that a host is openning port and share my folder such as C:\... I have a client that connect to the port and link to the host. however, I dunno that how can I do an sql statement to access to my host database, and then obtain the directory of the songs and play it. That is what I am currently headache of.
 
Regards,
ray

What is your host storing the music information as?  What is your host storing the music information as?

28-Feb-07 02:51 PM
If the music is being stored in a popular format (SQL, Oracle, MySQL, MS Access), you can use an ODBC driver or the provider data access model and generate your SQL queries using ADO.NET

If you're using a proprietary method (just a list of files in a folder or a text file, etc.) then you'll need to work on a custom solution, which we may be able to help with.

I describe more detail here.  I describe more detail here.

28-Feb-07 03:00 PM

Ok well, now I have a host with different Pc. Now I create a folder in C drive so all my songs will be inside the C:\abc folder.

So, my karaoke file directory in host pc should be C:\abc\def.wmv

Now, host has a mysql database which contain those songs details such as song's name, singer'name etc.

client would have to double click on a GUI, which has a button to show all singer's name. So it should be connect to the database from the host and retrieve back to show in the GUI at the client part. That's is what I am currently met. After that, they choose the songs and I have an API video which should obtain from the host to play at the client side.

 

Things are simpler now...  Things are simpler now...

28-Feb-07 04:38 PM
Alrighty, things are a bit simpler now.

When you say "connection" to the host PC, I'm assuming you're talking about a constant connection, not like a web site where you connect, grab some data, and then the connection is automatically closed.

So in the first regard, you can use the .NET provider for MySQL (Check out the MySQL site) to do your basic search for music songs. The nice part about this is that the connection is brief, which will save resources, and you can use simple SQL syntax against your database to query based off of name, genre, artist, etc. Ultimately, all you're looking for is a path to the song they want.

So in the second regard, once the user clicks "Get Song" or whatever you desire, you have the path to the file specified and you can take several approaches to this. You could use a simple file copy technique which would pull the file over to the client's system and then execute the play. Another route would be to setup some kind of streaming environment, so that pieces of hte song are being sent constantly to the client while they are playing it. There are pros and cons to both approaches and it will depend more on your user environment and resources you have available to determine which item you would like.

Now I may be COMPLETELY going off tangent here, but have you looked for existing products to meet your solution? I used to use a program called NetJuke which was PHP based (hopefully they won't kick me out of here for saying that 8^D) that used my web server to give me a full "jukebox" of my MP3s that I would access from work. They didn't come down in a streaming mode, but since I was on broadband in both locations, the download time wasn't that noticable. It also generated m3u playlists that Winamp or iTunes picked up without issue. There may be a freeware solution out there that can get you up and runnign faster, if time is of the essence.

Hope this helps!
Ermm...  Ermm...
28-Feb-07 08:16 PM

First I would like thanks for your quick reply. However, I met a problem here. I dunno how to write the codes that client access the database over the network.

Issit the when the host start the server, it straight open the database and wait for listening or when the client requesting only open the database?

I am quite a beginner of VB user and hope to seek more help from you all. Thanks

 

p/s: I found that the netjuke is a php based but not vb.net based. I am totally a newbie about php and my project doesn't touch on that seems it not across internet.

Regards,

Ray

A few remarks...  A few remarks...
01-Mar-07 11:38 AM
The database on your host is always running. It just sits there "listening" for anybody that wants to connect. The client is responsible for opening a connection to the database, querying for the data, and then closing the connection.

Going over the code to connect to the database and query and all of that is a bit beyond the scope of a simple forum post here. I'd highly recommend checking out the .NET quickstart tutorials. They can give you an overview of programming in .NET and they also cover ADO.NET which is the standard mechanism for connecting to databases. They will be talking about SQL Server in their examples, but ADO functions at a "Generic" level so that as long as you have a MySQL provider for ADO.NET, then you'll be using the same type of commands, just potentially structuring your SQL statements differently.

You can acces the QuickStart tutorials here: http://quickstarts.asp.net/QuickStartv20/aspnet/
sorry..but  sorry..but
02-Mar-07 11:17 AM
Ya I c that. However it is using the visual web developer but not VB.net, I am currently doing across intranet but not using any webpage to do it. So is it possible to use asp or ado.net inside VB.net form? and how to do that?
Yes you can use ADO.NET in WinForms  Yes you can use ADO.NET in WinForms
02-Mar-07 11:44 AM
ADO.NET works in both web apps as well as windows forms apps as well. I'm getting a little confused that you're using visual web developer but not building a web application. Are you using Visual Studio 2003/2005 or are you using one of the Visual Studio Express applications?

To use ADO.NET in your app, get the MySQL connector, which is a ADO.NET driver for MySQL from the MySQL Site - http://www.mysql.com/products/connector/

From there, you just need to write the code to connect, query, and process the results. Here are some great examples, also provided from MySQL - http://dev.mysql.com/doc/refman/5.0/en/connector-net-examples.html
ya  ya
02-Mar-07 11:52 AM
I am using VB 2005 express edition + mysql database. So is it ADO.net still can be used in this version of vb.net?
Most definitely...  Most definitely...
02-Mar-07 12:33 PM
ADO.NET is simply a component of the .NET framework. It specializes in providing a common library of methods/properties for interacting with a database, regardless of the database technology (Oracle, MySQL, SQL Server, etc.)

When looking at the .NET Framework as a whole you can break it up into a few different categories...

Presentation - ASP.NET for web based applications and Windows Forms for console or desktop based applications

Language - Visual Basic.NET and C# are the prominent languages for coding your web based or console based application. But the way .NET is structured you can use any language that has a .NET compiler for it, such as Perl, Eiffel, and more.

Data - ADO.NET (Abstract Data Objects) is the "middle" piece. It represents a collection of objects and methods designed for interacting with databases. You can use ADO.NET regardless of the database or language you're programming in. Microsoft released some ADO.NET libraries for the popular database technologies, but each company typically releases their own that is more specialized.
thanks, may u giv me some example?  thanks, may u giv me some example?
02-Mar-07 01:49 PM

as above. may u giv me some example links that using those asp.net or ado.net in windows form but not web based?

I went through all the links you gave me at the quick start there but it is with web based.

I would like to ask 1 question here..it may seems stupid question but I would like to ask here. As I went through the quickstart just now. I saw 1 example that may suit my situation. The asp.net code is "server=(local)\SQLExpress;database=Pubs;Integrated Security=true"
is that mean that when the client connected to the server, it will take the database from the host as it's own database and process that? If yes, is that can convert the codes to VB windows form codes as it is web based asp.net codes.

same to below:"server=(local)\SQLExpress;AttachDbFileName=|DataDirectory|MyDatabase.mdf;Integrated Security=true;User Instance=true"

More info...  More info...
02-Mar-07 03:39 PM
Upon further inspection of the Quickstart link I gave you, it was only covering the new features within the 2.0 framework. The original Windows Forms tutorials are here:

http://www.dotnetjunkies.com/quickstart/winforms/

Make sure to check out the Building Applications -> Data Access Overview section, which gives you an intro into ADO.NET. There is too much info to try and post in a thread here, they will have a great resource of code.

As for your question, database processing doesn't work by "taking the database as its own". The way data access works in this regard is that the client connects to the host and queries it for information. When you get the results of that query, you process it however you like. Both of your samples refer to "connection strings" which is the source and method that ADO is connecting to the database.

Remember, ADO.NET is NOT web based, it is an independent set of libraries that makes interacting with a database simpler.


thanks  thanks
02-Mar-07 04:32 PM

woot..thanks for the info..now I am having more understanding about this.

Dim myConnection As SqlConnection = New SqlConnection("server=(local)\NetSDK;Integrated Security=SSPI;database=northwind")

this is for the sql server.

But I am having the mysql database and the code for mysql connector should be

Dim myConnection As MysqlConnection = New Mysqlconnection("server={0};user id={1}; password={2}; database={3}; pooling=false", _
        '    "127.0.0.1", "", "", "kara_db")

so what should I put inside the user id and password..it seems to put the host user id and host database password. However, is it correct to having the userid and password in the client part?

 

 

Yes, you need user/password on client side...  Yes, you need user/password on client side...
02-Mar-07 04:50 PM
Otherwise, your database is open to any connection whatsoever, which is a security problem. Having the UserID and the Password in the connection string also opens up some security issues, but there are ways to encrypt the connection string in a way that your end users will not be able to see. Peek around here, if I remember correctly there is an article on it.
Create New Account
help
ms sql & mysql SQL Server can i run both on the same server? SQL Server Discussions SQL Server (1) MySQL (1) SQL Server Books Online (1) Microsoft sql (1) Online (1) Mindspring
Compound INSERT SELECT FROM WHERE subquery problem MySQL -> SQL Server 2005 conversion SQL Server , SQL, Server, 2005, conversion" / > This SQL language is nuts, just nuts. How does anybody put up with such a crude scripting
SQL Server SQL Server Security Discussions SQL Server (1) Role (1) Privileges (1) Database (1) Hi, The following excerpt is taken from Chapter 5 - Microsoft SQL Server 2000 Security of Microsoft SQL Server 2000 Administrator's Pocket Consultant (ISBN 0-7356-1129
What's the go with sql server SQL Server I was just saying today that sql server is full of silly limitations and I seem to hit on a new one every features with more ways to manipulate things than you can poke a stick at. In sql server we don't even have a full range of date functions (a pretty basic feature
SQL Server Migration Assistant Wizard for ACCESS - can't connect to SQL Server SQL Server Hello - - The Wizard leads me through finding and adding the mdb files, and then shows the following error in the step "Connect to SQL Server 2005": an instance of SQL Server 2005." Relevant information about my SQL Server 2005 version