473,410 Members | 1,875 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,410 software developers and data experts.

connect combo box to database

i want to connect combo box of my vb.net project to a table in database.how should i achieve it please help me..pls illustrate full syntax for that connection.
Feb 8 '12 #1
4 2809
Dim adp As New OleDbDataAdapter("select * from tblEmplyee", con)
ds = New DataSet
adp.Fill(ds)
ComboBox1.DataSource = ds.Tables(0)
ComboBox1.DisplayMember = "EmpName"
ComboBox1.ValueMember = "EmpID"
Feb 8 '12 #2
thanks dilbag..i will try it and later tell you whether its workin or not...
Feb 9 '12 #3
Dim strquery As String
Dim cn As SqlConnection
Dim cmd As SqlCommand
Dim dr As SqlDataReader
strquery = "select * from tblNewbill"
cn = New SqlConnection(strconnectionstring)
cmd = New SqlCommand(strquery, cn)
cn.Open()
dr = cmd.ExecuteReader
Do While dr.Read
cbobox1.Items.Add(dr.Item(0))

Loop
Feb 9 '12 #4
its not giving any errors but at the same time its not working also...
Feb 9 '12 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Alex Hardin | last post by:
Hey, I'm trying to use the connect to database wizard to connect to a MySQL database on my web server, 66.235.193.45 (I'm actually not sure if that points specifically to my part of the server, if...
1
by: John Bailo | last post by:
I just loaded c# express and sql05 express. When I try to connect to the database from c#e nothing happens. I tried "connect to database" and when I click on the menu, it just goes away and...
3
by: mbsparrow | last post by:
I have just installed sql server 2005 Express . The Server is running but I can't connect to the Server in Server Management Studio (on the same machine). I am getting the following message: ...
1
by: =?Utf-8?B?TmVsc29uIEFuZHLDqQ==?= | last post by:
Dear friends, I'm a Web Services newbie and I have created a simple Web Service that given 3 parameters accesses a database and returns 1 value. When run from Visual Studio 2005, the Webservice...
0
by: manevolution | last post by:
I've used php mambo and oracle 9 to develop a web-based application..I also used separate server for database and the system..but sometime an error occur to the database connection, its display...
0
by: asad56 | last post by:
I am workin with a superstore managment project. I connect Access database with main form . Then it work properly. But now I connect same database with another table or field in another form which is...
4
by: =?Utf-8?B?RGF2ZQ==?= | last post by:
This is kind of a cross forum problem. I am trying to Connect to database by clicking on: Tools Connect To Database Select: Microsoft SQL Server (SqlClient). However, there are no server listed...
0
by: Wendi Turner | last post by:
ASP.NET 2.0 C# WebService Connect to Database: Sql Server 2005 --------------------------------------------------------------------------------------------------- I have successfully created a...
2
by: Wendi Turner | last post by:
ASP.NET 2.0 C# WebService Connect to Database: Sql Server 2005 --------------------------------------------------------------------------------------------------- I have successfully created a...
0
by: kurakar | last post by:
Dear all, How to connect SQL Database from Server 2005 through dyndns in php, My dyndns address - xxx-xxx.dyndns.org Port - 3389(default) This is the code i am using: $dsn =...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.