Deploying a database with a VB.NET application

knappster

Active member
Joined
Nov 13, 2006
Messages
42
Programming Experience
Beginner
Hi, I have created a windows VB.NET application that I want to deploy as a setup file. It uses SQL Server Express as the database but I have just thought, does the computer that wants to use the app need to have SQL Server Express installed on it to use the application? If I use MS Access instead then does the computer need that installed to use the application? If so what's the best way of saving the data so that any computer can use it? I thought of an XML file and a dataset but you can't do joins on the tables can you?
Cheers.
 
Hi, I have created a windows VB.NET application that I want to deploy as a setup file. It uses SQL Server Express as the database but I have just thought, does the computer that wants to use the app need to have SQL Server Express installed on it to use the application? If I use MS Access instead then does the computer need that installed to use the application? If so what's the best way of saving the data so that any computer can use it? I thought of an XML file and a dataset but you can't do joins on the tables can you?
Cheers.

no, a computer doesnt need to have sql server express on it to use the application, as the application will connect to a server (using an ip address or something) to another computer anywhere in the world. the only thing you would need would be the .net redist. package. as long as the intended server has sql express installed (obviously! :)), the application should run fine. if you use ms access you need to distribute the application with the access runtime as well as the mdac (microsoft data access files?) package to ensure compatibility with random computers.

i suppose an xml file could work, but in regards to the joins and relationships, i think you would have to enforce them from your code.

hope it helps mate, have a good one :)

regards
adam
 
Hi, thanks for your reply! The thing is it will be a standalone windows package and won't be connecting to the internet. So from your reply it looks like the computer that is installing the application will need either SQL Express or Access to run it then? Looks like XML is the way to go then and I'll have to look into enforcing joins and relationships from code.
Cheers!
 
You can send the .MDF file out with your app but the target computer must have access to a suitable SQLEXPRESS instance to use it. If the computer has an instance of SQLSX installed, you can reuse that. SQLSX is free to redistribute, so you can package it with your app..

Try not to see this as a hurdle. It is effectively the equivalent of writing your app in .NET 2. The machine needs the .NET framework 2 installed to run the app.

No .NET2. No app.
No SQLSX. No app.

you see webpages saying "This app needs the .net2 fw to run, download here"
Its no different for you to say:
"This app needs an instance of SQLSX to run, downlaod here (or include on cd)"


We even had this with Access - if you were trying to use an app and didnt have the Jet driver installed, you had to install it.. back then we called it MDAC.. When XP came along and all the computers in the wild already had jet drivers, we kinda forgot those olden days of installing it (or whatever OS it was where jet came as standard)

I dont know if vista has dumped jet and included SQLSX as standard, but it should do.. Then developers can write SQLSX apps like they did Jet apps, without worrying of the end machine has the drivers..
 
To be honest 99% of the machines will be using XP so if I use Access as the database then the machines will have the necessary drivers to read and write to an Access database? But if I use SQL Express then I will need to package the redistributables and install them before being able to use the application. Have I got that right??
Cheers for your replies.
 
there is an application out there called dotNetInstaller which i heartily recommend from previous experience. it is a program that allows you to basically customize everything about a program's installation, including defining pre-requisites (such as sqlx, mdac etc) and works extremely well (it did for me)

here is the d/l link :)

http://sourceforge.net/project/showfiles.php?group_id=183471

good luck! any problems let us know and we will help you as much as we can.

anyone else out there know of other/better alternatives to what im suggesting (note: ive never played with the vs2k5 installer creators as to my knowledge they dont offer the level of customization that the above program does. feel free to correct :))?

have a good one

regards
adam
 
I don't know how to ask my question and where to post my question.. because here is so many threads... I'm really sorry if i post in a wrong one... i just want to ask... Code below is my code.. i use code from vb6 and i copy it into vb.net... but there is an error. the red word that i highlight it... it can be use in vb.net... so when we run... then we add. it can't be add into database..
I'm really really sorry if my question hard to being understand 'coz my english is not very good... :(
Thanks..
And one more.. in vb.net can we use ADODB as the connection to database beside OleDB??
Again, Thank you very much.....


Private Sub BtnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnSave.Click
On Error GoTo HandleErrors
Dim strsql As String
strsql = "Insert Into tbladd " _
&
"([Id],[Type],[Distributor],[Quantity],[Price]) " _
&
"values ('txtID','txttype','txtdistri','txtquantity','txtprice')"
conAVB.Execute(strsql, , adcmdtext)
rsStock.Requery()

ActiveButton()
BtnSave.Enabled =
False
BtnAdd.Text = "&Add"
BtnSave_Click_Exit:
Exit Sub
HandleErrors:
Dim strMessage As String
Dim errDBError As ADODB.Error
For Each errDBError In conAVB.Errors
strMessage = strMessage & Err.Description & vbCrLf
Next
MsgBox(strMessage, vbExclamation, "Provider Error")
SetUpAddRecord()
On Error GoTo 0
End Sub
 
I don't know how to ask my question and where to post my question.. because here is so many threads... I'm really sorry if i post in a wrong one... i just want to ask... Code below is my code.. i use code from vb6 and i copy it into vb.net... but there is an error. the red word that i highlight it... it can be use in vb.net... so when we run... then we add. it can't be add into database.. so what code should i replace for that adcmdtext??
I'm really really sorry if my question hard to being understand 'coz my english is not very good... :(
Thanks..
And one more.. in vb.net can we use ADODB as the connection to database beside OleDB??
Again, Thank you very much.....


Private Sub BtnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnSave.Click
On Error GoTo HandleErrors
Dim strsql As String
strsql = "Insert Into tbladd " _
&
"([Id],[Type],[Distributor],[Quantity],[Price]) " _
&
"values ('txtID','txttype','txtdistri','txtquantity','txtprice')"
conAVB.Execute(strsql, , adcmdtext)
rsStock.Requery()

ActiveButton()
BtnSave.Enabled =
False
BtnAdd.Text = "&Add"
BtnSave_Click_Exit:
Exit Sub
HandleErrors:
Dim strMessage As String
Dim errDBError As ADODB.Error
For Each errDBError In conAVB.Errors
strMessage = strMessage & Err.Description & vbCrLf
Next
MsgBox(strMessage, vbExclamation, "Provider Error")
SetUpAddRecord()
On Error GoTo 0
End Sub
 
Sorry for being post the same thing twice.. because connection in here too slow.. so i think it can't post so i click post twice then when appear there is two.. and i don't know how to delete it one.... really really sorry.... :(
 
You can delete your post from the EDIT screen

Read the DW2 link in my signature.. It will help with database access
 
Back
Top