| | |
How to select a value in the database
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Jun 2009
Posts: 4
Reputation:
Solved Threads: 0
Using VB.NET
I am using Combobox, when i select the value in combobox, the date value should display in datetimepicker where date = combobox id
vb6 code
txtno - combobox, txtname = datetimepicker1
The above code is working in vb6, But am new to vb.net
How to modify my code in vb.net
Need vb.net code help
I am using Combobox, when i select the value in combobox, the date value should display in datetimepicker where date = combobox id
vb6 code
VB.NET Syntax (Toggle Plain Text)
cmd.CommandText = "select distinct Name from T_Person where personid = '" & txtno & "'" Set rs = cmd.Execute While Not rs.EOF If Not IsNull(rs("Name")) Then txtName.Text = rs("Name") rs.MoveNext End If Wend
txtno - combobox, txtname = datetimepicker1
The above code is working in vb6, But am new to vb.net
How to modify my code in vb.net
Need vb.net code help
•
•
Join Date: Aug 2009
Posts: 94
Reputation:
Solved Threads: 6
0
#2 Nov 3rd, 2009
vb Syntax (Toggle Plain Text)
Dim myDA As New OleDbDataAdapter myCmd.CommandText = "select distinct Name from T_Person where personid = '" & txtno & "'" myDA.SelectCommand = myCmd myDR = myCmd.ExecuteReader() While (myDR.Read()) myDR("Name")) End While
•
•
Join Date: Sep 2009
Posts: 307
Reputation:
Solved Threads: 44
0
#3 Nov 3rd, 2009
I dont understand the need for a loop to assign control values when only a single value can be displayed in the textbox and datepicker at a time. Also Im a bit confused by the naming conventions, a prefix for txt for a datepicker and your saying your looking for a date but the select statement shows your querying a field named "Name".
•
•
Join Date: Nov 2009
Posts: 1
Reputation:
Solved Threads: 0
I have the same problem I am trying to read distinct values from an Access table but i get a syntax error. heres my code . The Code works fine until I put in the distinct key word.
can anyone point me in the right direction.
thanks
james
VB.NET Syntax (Toggle Plain Text)
sql = "SELECT DISTINCT Model,Make,Problem,HP FROM Makes"
can anyone point me in the right direction.
thanks
james
Last edited by JAM1011; Nov 3rd, 2009 at 8:21 pm.
0
#5 Nov 3rd, 2009
Your SQL syntax is invalid. Typically you use
It should be similar for access.
Distinct() on a single column. I'm not sure if this is the exact syntax with Access but this is how it would work in MSSQL: sql Syntax (Toggle Plain Text)
SELECT Model, Make, Problem, HP FROM Makers GROUP BY Model, Make, Problem, HP ORDER BY Model, Make, Problem, HP --This is an optional ordering line
It should be similar for access.
Last edited by sknake; Nov 3rd, 2009 at 9:13 pm.
![]() |
Similar Threads
- VB: Connect to Access database via ODBC datasource name (Visual Basic 4 / 5 / 6)
- retrieve data to DOM select from database (JavaScript / DHTML / AJAX)
- Writing to an Access Database (Visual Basic 4 / 5 / 6)
- submiting info into a database for retrieval! (PHP)
- mySQL database searching for registration (MySQL)
- php wont submit data into the database (PHP)
- Writing to an Access Database using Java... (Java)
Other Threads in the VB.NET Forum
- Previous Thread: Need to convert from string to integer
- Next Thread: Loading user input into parralell arrays, Please help!
| Thread Tools | Search this Thread |
"crystal 2.0 2008 access advanced application asp.net basic beginner bing c# code connectionstring control convert crystalreport cuesent database datagrid datagridview eclipse excel expose firewall folder ftp function google images inline map memory mobile ms networking objects open picturebox plugin port printing printpreview problem project relationaldatabases reports" save savedialog search settings shutdown soap socket sql sqldatbase sqlserver2005 tcp textbox vb vb.net view visual visualbasic visualbasic.net visualstudio visualstudio.net wizard







