Author Topic: Database Management In Visual Studio  (Read 7772 times)

  • Guest
Database Management In Visual Studio
« on: August 13, 2010, 05:55:29 PM »
I have begun teaching myself programming with the book "Teach Yourself VB 2010 in 24 hours"; pretty nice read, quite easy too... until I got to chapter 21 which deals with databases, which is kind of the ultimate goal for many programmers.
Now, I would for like somebody to explain me in plain english: is it really necessary (for simple projects at least, local stuff, no huge server dbases) to go through the SQL hassle?
Isn't it better to simply access directly the mdb file created by Microsoft Access? What are the advantages of SQL over direct file manipulation (although I understand it's managed by the Jet engine).
As you understand I am pretty confused right now... :(

  • Guest
Database Management In Visual Studio
« Reply #1 on: August 13, 2010, 06:12:08 PM »
I've done VB/VB .NET with Access and MS SQL a few years ago.

If it's for simple projects or for self-learning then go with Access (MDB) first, but do go with MS SQL Server later on for bigger projects.

  • Guest
Database Management In Visual Studio
« Reply #2 on: August 13, 2010, 08:00:09 PM »
Quote from: "geetard"
I've done VB/VB .NET with Access and MS SQL a few years ago.

If it's for simple projects or for self-learning then go with Access (MDB) first, but do go with MS SQL Server later on for bigger projects.

OK thanks.
Basically SQL server is an intermediate agent between the app (or IDE) and the data base?
Also, I have tried the upsizing wizard in Access to conver mdb to mdf but to no success; any tips on how to do that?

  • Guest
Database Management In Visual Studio
« Reply #3 on: August 13, 2010, 10:41:37 PM »
Quote from: "Fracicone"
Quote from: "geetard"
I've done VB/VB .NET with Access and MS SQL a few years ago.

If it's for simple projects or for self-learning then go with Access (MDB) first, but do go with MS SQL Server later on for bigger projects.

OK thanks.
Basically SQL server is an intermediate agent between the app (or IDE) and the data base?
Also, I have tried the upsizing wizard in Access to conver mdb to mdf but to no success; any tips on how to do that?

SQL Server is the database. The app is the intermediate between the user and the database. It all depends on how you look at it I guess.

You'd want a proper database server (MS SQL, MySQL, Oracle, etc.) if you're dealing with large volumes of data and have many transactions going on. Or if you need access to advanced features like triggers and stored procedures.

  • Guest
Database Management In Visual Studio
« Reply #4 on: August 14, 2010, 01:45:45 AM »
Fuck, even trying to access the mdb file directly is driving me crazy. I have a simple form in VB 2010 with two textboxes and this simple code and I get this error message:

A first chance exception of type 'System.Data.Odbc.OdbcException' occurred in System.Data.dll

And here's the code.
WHAT AM I DOING WRONG?
The dabatase is a simple 2 column db with 6 rows (names and states) so it's OK...

Public Class MainForm
    Private m_cn As New System.Data.Odbc.OdbcConnection
    Private m_DA As System.Data.Odbc.OdbcDataAdapter
    Private m_CB As System.Data.Odbc.OdbcCommandBuilder
    Private m_DataTable As New DataTable
    Private m_RowPosition As Integer = 0
    Private Sub MainForm_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
        m_cn.Close()
        m_cn.Dispose()
    End Sub

    Private Sub ShowCurrentRecord()
        If m_DataTable.Rows.Count = 0 Then
            txtContactName.Text = ""
            txtState.Text = ""
            Exit Sub
        End If
        txtContactName.text = m_DataTable.Rows(m_RowPosition)("Contact Name").ToString()
        txtState.text = m_DataTable.Rows(m_RowPosition)("State").ToString()

    End Sub

    Private Sub MainForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        m_cn.ConnectionString = "Driver={Microsoft Access Driver (*.mdb)};DBQ=c:\Temp\Contacts.mdb"
        m_cn.Open()
        m_DA = New Odbc.OdbcDataAdapter("Select * From Contacts", m_cn)
        m_CB = New Odbc.OdbcCommandBuilder(m_DA)
        m_DA.Fill(m_DataTable)
        Me.ShowCurrentRecord()
    End Sub
End Class

  • Guest
Database Management In Visual Studio
« Reply #5 on: August 14, 2010, 01:57:17 AM »
BTW, I can see perfectly the data base with the DB exlporer in the Visual Studio IDE :|

  • Guest
Database Management In Visual Studio
« Reply #6 on: August 14, 2010, 05:06:05 AM »
OK, I have solved the issue; apparently I wasn't doing anything wrong and the problem relies in working with VS2010 on x64 OS (Win 7 in my case but I understand it applies to Vista x64 too); the compile properties of the solution must be se to target 32 bit CPUs and not ANY CPU. That did the trick :D

  • Guest
Database Management In Visual Studio
« Reply #7 on: August 14, 2010, 05:59:38 AM »
I quickly tried VS2010; I like the plugins support. I am now able to use Ctrl+click for object and method declarations/definitions like in Eclipse.

  • Guest
Database Management In Visual Studio
« Reply #8 on: August 14, 2010, 09:52:59 AM »
Quote from: "Fracicone"
OK, I have solved the issue; apparently I wasn't doing anything wrong and the problem relies in working with VS2010 on x64 OS (Win 7 in my case but I understand it applies to Vista x64 too); the compile properties of the solution must be se to target 32 bit CPUs and not ANY CPU. That did the trick :D

you know VB won't get you anywhere,right?

I don't really believe VB is a programming language at all

it's a tool for Skiddies :lol:

anyway,if you want to really learn programming,begin with python or php

then start learning something C-Like,like C++,java or C#

you'll feel like you're doing less in more time,but believe me,it'll all be worth it

  • Guest
Database Management In Visual Studio
« Reply #9 on: August 14, 2010, 06:31:59 PM »
Quote from: "Sargeras"
Quote from: "Fracicone"
OK, I have solved the issue; apparently I wasn't doing anything wrong and the problem relies in working with VS2010 on x64 OS (Win 7 in my case but I understand it applies to Vista x64 too); the compile properties of the solution must be se to target 32 bit CPUs and not ANY CPU. That did the trick :D

you know VB won't get you anywhere,right?

I don't really believe VB is a programming language at all

it's a tool for Skiddies :lol:

anyway,if you want to really learn programming,begin with python or php

then start learning something C-Like,like C++,java or C#

you'll feel like you're doing less in more time,but believe me,it'll all be worth it

Thanks for the tip and I am quite proud to say that I'd reached the same conclusion already :D
there's something inherently wrong about taking a language (Basic) that was designed to do some really simple stuff (it came preinstalled on commodore 64s in the 80s FFS) and trying to turn it into a powerful tool.
I'll finish the last 3 hours of the book I am reading (I don't like to leave businesses unfinished) and then dive into C++ which in turns might make it easy to learn Java which is so similar.
Still thanks for the suggestion, I'll look into php and Python :D

BTW, I thought C# (in spite of its name) was similar to VB...

  • Guest
Database Management In Visual Studio
« Reply #10 on: August 14, 2010, 06:55:45 PM »
you're welcome :)

another tip :Don't learn C++ before java,I learned java before C++ and I'm glad I did

java doesn't let you do any mistakes,enforces good OO design(to an extent)

C++ believes that you know what you're doing,so there are no real boundaries to what you can do with it,but with great power comes great responsibility :D

for example,if you use an invalid array index in C/C++,an arbitary memory block is written instead,which can cause trouble sometimes

java is good if you want to learn the syntax of C-Like programming languages

but if you want simpler syntax,and you want to do more in less time,you're better off with python or php

python has a huge standard library,you can do pretty much anything with it,it'll be also included in both .NET and Java platforms

for java,see The Da vinci Machine

for .NET,see DLR (Dynamic Language Runtime)

as for php,it's enough to say that it's the most used language on the web,even this forum is written in PHP,so you can't go wrong with that language

  • Guest
Database Management In Visual Studio
« Reply #11 on: August 14, 2010, 09:29:28 PM »
Quote from: "Sargeras"
as for php,it's enough to say that it's the most used language on the web,even this forum is written in PHP,so you can't go wrong with that language
Hmm, I'm pretty sure Java is the most used/popular programming language.

And yes, forget VB; it's an old language. Though, it can always come in handy if an employer needs to maintain some old VB-coded app or to port it into another language. ;)

  • Guest
Database Management In Visual Studio
« Reply #12 on: August 14, 2010, 10:18:09 PM »
Thanks guys; this is why I love this forum so much :D


BTW, which IDE for Java should I go for: Eclipse, Net Beans or Jcreator?

  • Guest
Database Management In Visual Studio
« Reply #13 on: August 14, 2010, 10:43:51 PM »
Personally, I prefer Eclipse as I've been using it for the past 5 years.

I only use NetBeans when I need to quickly make simple GUI's (drag and drop à-la Visual Studio).

  • Guest
Database Management In Visual Studio
« Reply #14 on: August 14, 2010, 10:51:21 PM »
Quote from: "geetard"
Personally, I prefer Eclipse as I've been using it for the past 5 years.

I only use NetBeans when I need to quickly make simple GUI's (drag and drop à-la Visual Studio).

Yeah, I also understand Eclipse is popular to develop for mobile phones.