Populate Result Of A Query In A Combobox?
Sep 30, 2010I am new in vb.net 2008.I want to populate items of a combobox with a result of a query that may include join or not.
View 3 RepliesI am new in vb.net 2008.I want to populate items of a combobox with a result of a query that may include join or not.
View 3 RepliesI have added a query to my form using the sqlDataAdapter object and the wizard.Now I want to show the result of the query in a combox on my form.The combobox is not binded to a data source, but is going to be used for searching a record (but this is for later)
View 10 RepliesI have 2 tables: locations and depot:[code]I have 2 forms, frm1 and frm2. Frm1 has a combobox, cboLocations which pulls from the Locations table. Frm2 has textboxes which populate based upon the location selected from cboLocations on frm1. Frm2 also has a combobox, cboDepot, which pulls from the Depot table.So far, I've been able to get cboDepot to populate with the first depot_refnbr. This is not the corresponding depot_refnbr that matches with the selected Location; it is just the first depot_refnbr in the Depot table.I need to populate cboDepot's text property with the depot_name, and not the depot_refnbr that corresponds with the Location selected on frm1 from cboLocations.Frm1 has a button, and I'm not sure if I'd have to code this in the button click event, the cboLocation_Selected IndexChanged event, or in frm2's load event.
View 11 Repliesfollowing issue I'm having:
I have 2 tables: locations and depot:
Locations:
site_refnbr (primary key)
site_name
depot_refnbr(foreign key)
[Code]...
I need to populate cboDepot's text property with the depot_name, and not the depot_refnbr that corresponds with the Location selected on frm1 from cboLocations.Frm1 has a button, and I'm not sure if I'd have to code this in the button click event, the cboLocation_Selected IndexChanged event, or in frm2's load event.
how to take a query that returns a single row of data and load that data into textbox controls.I know about ExecuteScalar but it is only good for a single column of data from the query.
View 2 RepliesI'm trying to fill combobox with my SQL query result.[code]...
View 2 RepliesI am trying to fill a combobox using the results form a query to combine two fields (first and Last name). I cannot seam to get to the query through the table adapter. I can set the binding source and select one of the fields to fill the control but I cannot get to the query's.
View 2 Repliesi'm trying to populate a simple combobox with a query to a MySql database. I Just want the combobox to show the results of the query:
SELET DISTINCT models from Cars
I am using VB 2008 with Datasets, how can I achieve this?
I am currently having a headache on how to solve this problem that i am facing. here is the situation: I have a combobox and a list box on the main form. The combobox will get the data from the ms access database. In the database, i have the details of a person's IC, Name and DOB say for eg on one entry I have D215311523C,SHAWN,13/04/1987 So now, my combobox on form load will show the list of dates in the database to allow the user to search base on the date itself by clicking on the selected date. So when the user clicks on the particular date say 13/04/1987, people in the database whose birthday is 13/04/1987 will be shown on the listbox.Meaning to say if i have 3 entries whose dates are the same 13/04/1987, 3 entries will appear. If there is only two entry, then two results will be shown. But now, when i do a single click on the date, one result will be shown. That is correct. But the problem is when i click on the same date again, three of the same results will be shown on the list box. that is it will display : 13/04/1987 13/04/1987 13/04/1987 which is not the case. Then it will show more duplicates of the same results if i click more times on the same date which should not be the case.
Dim n As Integer
Dim numbers() As Integer
Dim StartFrom As Integer
Dim EndAt As Integer
[code].....
I need to pull from an access database to populate a combobox. Then from there I need to have a second combo box populated depending on the selection in the first box. My thought of an example would be a website that is setup for selecting car make, modle,year...can that be done in VB?
View 1 RepliesI have two ComboBoxes
<ComboBox Name="cmbMake" DisplayMemberPath="MakeName" SelectedValuePath="MakeID"/>
<ComboBox Name="cmbModel" DisplayMemberPath="ModelName"/>
I use LINQ-to-Entities to populate the cmbGroup ComboBox
Dim db as myDataEntity
cmbGroup.ItemsSource = db.Makes
How do I populate my second ComboBox (cmbModels) based on the selection of the first ComboBox (cmbMake) using XAML so that whatever I select in the first ComboBox automatically filters the ItemsSource in the second ComboBox?
I currently have a form with two comboxes. The first cbo is being populated with a project number, which is being pulled from the first column of a spreadsheet. I now want the second cbo to read the first cbo and then find that project number on the spreadsheet; when it finds that project number, I then need it to copy data from the row the project number is on. I have converted to vb from vba. Below is the code I used in vba (which obviously does not work). I only need certain cells from the project row.
Dim proj_num, rng As Range
Dim data, i As Long, j As Long
With Sheet1
[code].....
I have the following code in my project:
rivate Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim connectionString As String
[code].....
I want to bind the following query result to datatable:
Dim query = From c in db.Customers _
Where c.Status = "Active" _
Select c.CId, c.FirstName, c.LastName, c.Email
First time poster and new to ASP programming.I have a functional database to where i am trying to add new functionality.I'm trying to add the idea to check if a returned string is empty, if so get value from a backup table which holds historical information. Here is what i have got for the specific part:
[Code]...
I'm trying to run a query and display the result in a listbox. I can do it for a datagridview but not for a listbox .
Code:
Private Sub frmNieuweActie_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
strSql = "SELECT Acties.Actieid, Acties.Actie " & _
"FROM(Acties) " & _
[code]....
I get the correct amount of items in my listbox but it displays "System.Data.DataRowView" as item .
I am facing a problem displaying the result of my "select *" query on the form . Here is my code:
[code]...
But when I write this code and run my form I am not able to see any records present in my database tables being displayed on my form. I have inserted a DataGridView on my form . What changes should I do to my code ?
I have a sql query which is returning null value below is the section the iID is null.Once debugger reaches this it goes to exception as its result is NULL. How to control debugger from going to the exception.
[Code]...
How do I assign the query result to a variable.I am using SQLlite. Below is the code for retrieving password from the User Table. I need to compare the given password and the given password.
Dim i As String
Dim p As String
i = txtUserID.Text
[code].....
I would like to parse the result of entering a query at [URL] the problem is that I cant seem to the post data just right and cant properly open a webrequest to the site.
View 3 RepliesI'm trying to show some concatenated data in a CheckedListBox so that users are able to select the data for use later on. Here is the code I am using currently:
Dim con As New MySqlConnection
Dim theQuery As New MySqlCommand
Dim theTables As New DataTable
[Code].....
Is there a way to show the value retrieved by an SQL statement in a message box? In context, my SQL statement searches my database to find a customer record that matches the details entered into the text boxes on the form, and retrieves the CustomerID. Is there a way to show this CustomerID in a message box?
The SQL code is:
SELECT customerid
from customer
where cust_forename = @custforename and cust_surname = @custsurname and cust_house = @custhouse etc
I have a stored procedure:
CREATE PROCEDURE [TestProc]
AS
BEGIN
select '1a', '1b'
select '2a', '2b', '2c'
select '3a', '3b'
END
If I execute the following query using SQL Management Studio,
[Code]...
How can I get the three result sets using SqlDataReader? Or even three SqlDataReader's? Or is it possible to get multiple result sets in just one query in VB.NET? Is DataSet my only option?
I have two text box(Start Value and End Value), one datagridview and a search button SQL script= Select id, ContactName from Customers where id between 1 and 5 I want a scenario where when I enter the start value 1 and end value 5 and click the search button it will run the above query and display the result in the datagrid view.
View 4 RepliesI'm looking to store the result of SQL count function in a variable, i've tried numerous ways but haven't managed to get it to work?
View 3 RepliesI'm just wondering if it's possibe to get the results from a query and then assign the results to a variable. So I will run a query which will return the names of the tables stored in the database, then I want them to be stored in a variable. So it would be something along the lines of:
Dim strFrom AS String = "FROM "
strQuery = "SELECT * FROM information_schema.TABLES WHERE TABLE_SCHEMA = 'Database1'"
con.Open()
[Code]....
I have the following code which returns a single row and column of an MS Access database. My goal is to put it into the Text property of a textbox. Can please someone explain me how to do it?
Dim cmd1 As New OleDbCommand("SELECT NOME From FORN_NIB Where NUMERO = ?", cn)
Dim P2 As New OleDbParameter
cmd1.Parameters.AddWithValue("P2", ComboBox1.Text)
Dim Reader1 As OleDbDataReader = cmd1.ExecuteReader()
Dim dt1 As New DataTable
dt1.Load(Reader1)
I have a for xml raw select query that returns a xml string in server2005 and i would like to write that string to a file using vb.net.
View 2 RepliesI have completed this code, but I cant seem to get the answer into the combobox?
Dim mydatabase As String = DatabaseNameComboBox.Text
Dim TableNaming As String = TableNameComboBox.Text
Dim DatabaseConn As New OleDbConnection
Dim DatabaseConnString As New OleDbConnectionStringBuilder
Dim strSQL As String = "Select * from " & TableNaming & ""
[Code] .....
This last line, just adds the select * from statement, but I want the column names?
Here is the original xml file
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<setup>
<cap>33</cap>
</setup>
[Code]...