Hello,

I am very new to Visual Basic and try to teach myself again after years and years of not using it. Learned very basic codes back in school but that was too long ago.

So far I have wrote only ONE application. Basic input, calculate and output. Came out almost bug free and I was very excited. But was very simple

I am trying to write an application that uses SQL local database. Why it needs to connect is still beyond me, but anyhow.. here is my problem.

I have read many locations that when I created a database I should then use a Database Form Wizard. Well hold and behold VS 2008 doesn't have that feature anymore since the application/form was retired. Great, I have read some more sites but just can't find the help. I figured by having using the Wizard I can better understand the interaction between the form and database by looking at the code.

So... reading the VB6 book and several tutorial sites, I still can't figure out what code I need to a) add data, b) edit data, C) delete data. Specifically how to interact Click with database.

So far I have the form, I have database table, have established connection. Just missing the code for click.

No, this is not a homework assignment which I have read through several posts here. This is for personal purpose, personal fun, personal time. If the application becomes successful, I may write more complex application than this one with bigger database and provide it to the gaming community.

I appreciate you help in advance. I am not expecting for someone to give me the code right off the back. If you do great, if not then please point me to right direction or give me a hint ;)

Xad

Forgot to mention.

I do not have the code to show since I don't know where to begin. As far as coding goes. The only thing i have now is...

Public Class Form2

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click

    End Sub
End Class

Pretty empty isn't it?

Xad

Edited 3 Years Ago by Reverend Jim: Fixed formatting

I am using Visual Studio 2008 Professional (full version).

As for ADO .net I have tried www.ado.net and google search. Mostly find websites about ADO.net but specifically ADO.net tutorial section. Maybe I am looking at the wrong place.

Xad

Thank you for finding links for me.

One question I forgot to ask. If i make the application to use a database, and let someone else use the application on their computer. Does that computer have to have VB/VS or will the application run without the necessary major application?

As for the link you have sent, thank you. Though I think it confused me even more. First of all why use OLEdbConnect vs SQLdbConnect, or should I ask what is the difference, if I want to use local database? Currently using VS database table maker instead of Access, Excel or .xml.

The other question would be. Is it possible not to directly bind text box to database but rather from search result? Or is it actually bound but won't load until i select specific item/id/name then load?

For example, I want write a code for search engine or search *string* then have a list of names show up on one window, click on one of the names then display all the information in various Text boxes.

Again, many thanks in advance for your help and time.

Xad

Great thank you.

What about the difference between OLEdbConnect and SQLdbConnect, what are the differences?

And is it possible to bind text boxes to database indirectly or tell it not to load directly from database until I have selected from search window/menu?

Xad

Okay, i got whole lot farther than I did few days ago as far as coding goes lol.

But I still have one problem, despite reading those links above. Something just doesn't seem to add up in my code. I was able to add few data into database directly, and during run program it loaded just fine. However when I attempt to Add data to the database with Add Button, nothing happens, no error of any kind.
Here are the file names..

Table: CLTable
Craftlist.mdf
CraftlistDataSet.xsd

And here is the code

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Me.BindingContext(CraftlistDataSet, "CLTable").AddNew()
        MsgBox("Successfully Inserted")
    End Sub

Soo, what am I doing wrong. Please bear with me since I am really new to VB. I appreciate your help.

Xad

This article has been dead for over six months. Start a new discussion instead.