| |

VerySource

 Forgot password?
 Register
Search
View: 595|Reply: 1

Rookie problem The problem of binding controls such as textbox lable to the database

[Copy link]

1

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-2-1 20:20:01
| Show all posts |Read mode
For example, suppose there is an ACCESS database students.mdl which has a table student and then the table has id, name ...
   Now I want to display the name in the student table in textbox1, such as where id = 1
   Thank you
Reply

Use magic Report

0

Threads

4

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-4-18 23:45:02
| Show all posts
'First take the access library to the dataset
        dim olecon as New OleDb.OleDbConnection ("Provider = Microsoft.Jet.OLEDB.4.0; Data Source =" + Application.StartupPath + "\Students.mdb; User Id = admin; Password =;")
  olecon.Open ()
        dim oleadp As OleDb.OleDbDataAdapter
        dim ds as new dataset
        oleadp = New OleDb.OleDbDataAdapter ("select * from student where id = 1", olecon)
        oleadp.Fill (ds, "student")
        'Set the binding
        textbox1.DataBindings.Add (New Binding ("Text", ds, "student.name"))
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list