5 Replies - 581 Views - Last Post: 09 May 2011 - 08:36 AM Rate Topic: -----

#1 Killhate  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 09-May 11

URGENT! Loading items from access database

Posted 09 May 2011 - 12:21 AM

Hi everyone , i really need help with this one..i'm very noobish..here it goes,i've got access database connected to my project,i can read,write and delete records in it..what i need now is when i select one item from combobox (which is connected to table "clanovi"(members) and it loads their name and surname which is the first column of that table..now when i select one item from that combobox i need other info of members their adress,email,city etc to display in seperate textboxes..

this is the function that my friend made for me..it connects to the single table in database,in this case to table "clanovi" ..i really need some help with this.. thanks in advance

    Public con As New OleDb.OleDbConnection
    Public dbProvider As String
    Public dbSource As String
    Public ds As New DataSet
    Public da As OleDb.OleDbDataAdapter
    Public sql As String
    Public imeBB As String = "bazy-tenis"
    Public Sub Connection(ByVal tablica As String)
        ds.Clear()
        ds.Tables.Clear()
        da = New OleDb.OleDbDataAdapter
        con = New OleDb.OleDbConnection
        dbProvider = "Provider=Microsoft.ACE.OLEDB.12.0;"
        dbSource = "Data Source=bazy-tenis.accdb;Persist Security Info=False;"
        con.ConnectionString = dbProvider & dbSource
        con.Open()
        sql = "SELECT * FROM " & tablica
        da = New OleDb.OleDbDataAdapter(sql, con)
        da.Fill(ds, imeBB)
        con.Close()
        akcijaUpdate(imeBB)
    End Sub


Is This A Good Question/Topic? 0
  • +

Replies To: URGENT! Loading items from access database

#2 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 9210
  • View blog
  • Posts: 34,592
  • Joined: 12-June 08

Re: URGENT! Loading items from access database

Posted 09 May 2011 - 07:12 AM

What do you need help with? Is there an exception or error? If so what, and where? What have you tried? You sound like you have identified all the pieces and actions - work through those step by step and see what you can come up with!

Just a gentle reminder that DIC doesn't hand out code. We want to help you learn to be a fuller and more rounded developer! Try and let us know!
Was This Post Helpful? 0
  • +
  • -

#3 Killhate  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 09-May 11

Re: URGENT! Loading items from access database

Posted 09 May 2011 - 07:18 AM

just as you said i read it over and over and found it out..now i have one last problem and then my project is finished..i should hand it to school by friday... i have a checked list box where i select terrain1,terrain2,terrain3 etc..
and when i click on a button all rows from table "reservations" where culumn terrain is matching checked items should be displayed somewhere..where should that be?what is the easiest way? i thought with datagridview but i get error Unable to cast object of type 'System.String' to type 'System.Windows.Forms.DataGridViewCell'. ..what are the other ways for displaying that data and without any data binding please..thanks
Was This Post Helpful? 0
  • +
  • -

#4 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 9210
  • View blog
  • Posts: 34,592
  • Joined: 12-June 08

Re: URGENT! Loading items from access database

Posted 09 May 2011 - 07:24 AM

Quote

and when i click on a button all rows from table "reservations" where culumn terrain is matching checked items should be displayed somewhere..where should that be?


I have no idea where that should be. That depends on how you want it displayed. In a series of textboxes, a grid, colored icons, or what not.


Quote

what is the easiest way?

That depends on above


Quote

i thought with datagridview but i get error Unable to cast object of type 'System.String' to type 'System.Windows.Forms.DataGridViewCell'. ..what are the other ways for displaying that data and without any data binding please..thanks

grids, lists, comboboxes, custom controls, a text box, multiple textboxes, and so on. Eyeball the controls in the Toolbox (designer mode). Create your own even!
Was This Post Helpful? 0
  • +
  • -

#5 Killhate  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 09-May 11

Re: URGENT! Loading items from access database

Posted 09 May 2011 - 07:26 AM

i would prefer it to be in a table,how can i acomplish that? excuse me if i'm asking silly questions i am very new to programming ..
Was This Post Helpful? 0
  • +
  • -

#6 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 9210
  • View blog
  • Posts: 34,592
  • Joined: 12-June 08

Re: URGENT! Loading items from access database

Posted 09 May 2011 - 08:36 AM

You would accomplish it in small steps.

Plunk a grid down.
plunk down a button
Make a new method.
tie the method to the button click event
make a sql select statement for yoru terrain information using a 'where' clause utilizing the drop down information in the check box list.
make a generic dataset
make a sql adapter using the sql statement and a connection string to your database.
fill the dataset from the adapter.
set your grid's datasource to the dataset's first table.

Bam.. done!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1