•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the VB.NET section within the Software Development category of DaniWeb, a massive community of 403,031 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,864 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our VB.NET advertiser: Programming Forums
Views: 234 | Replies: 3
![]() |
•
•
Join Date: Jun 2008
Posts: 16
Reputation:
Rep Power: 1
Solved Threads: 0
This is my code to load data from a database(SQL Server 2000) into a combo box. I keep getting the error Name 'connString' not declared.(the highlighted section of the code). I've tried posing this error in Google search but there are no answers. I am working in a software development company, and this code is part of the system I am developing in that company.
'This method initializes the combo box in Item Category Level 1,
' adding data from the table inv_category but limiting the drop-down size
' to six rows so the combo box doesn't cover other controls when it expands.
Private Sub InitializeComboBox()
Me.CatCodeComboBox = New System.Windows.Forms.ComboBox
Dim conn As New SqlConnection(connString)
Dim strSQL As String = "SELECT ict_code FROM inv_itemcategory"
Dim da As New SqlDataAdapter(strSQL, conn)
Dim ds As New DataSet
da.Fill(ds, "inv_itemcategory")
With CatCodeComboBox
.DataSource = ds.Tables("inv_itemcategory")
.DisplayMember = "ict_code"
.ValueMember = "ict_code"
.SelectedIndex = 0
End With
Me.CatCodeComboBox.Location = New System.Drawing.Point(95, 32)
Me.CatCodeComboBox.MaxDropDownItems = 5
Me.CatCodeComboBox.DropDownStyle = ComboBoxStyle.DropDown
Me.CatCodeComboBox.Name = "CatCodeComboBox"
Me.CatCodeComboBox.Size = New System.Drawing.Size(292, 21)
Me.CatCodeComboBox.TabIndex = 0
Me.Controls.Add(Me.CatCodeComboBox)
End Sub Last edited by Aigini : Jun 20th, 2008 at 6:07 am.
where's your connString string?! the problem in it!
B.Sc Computer Science, Helwan University
Microsoft Student Partner
Personal blog http://ramymahrous.blogspot.com/
Arabic technical blog http://fci-h-ar.blogspot.com/
English technical blog http://fci-h.blogspot.com/
Microsoft Student Partner
Personal blog http://ramymahrous.blogspot.com/
Arabic technical blog http://fci-h-ar.blogspot.com/
English technical blog http://fci-h.blogspot.com/
•
•
Join Date: Jun 2008
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
first declare connString as string variable
and assign connection string i.e database name and password path of that every thing.
and assign connection string i.e database name and password path of that every thing.
•
•
•
•
This is my code to load data from a database(SQL Server 2000) into a combo box. I keep getting the error Name 'connString' not declared.(the highlighted section of the code). I've tried posing this error in Google search but there are no answers. I am working in a software development company, and this code is part of the system I am developing in that company.
'This method initializes the combo box in Item Category Level 1, ' adding data from the table inv_category but limiting the drop-down size ' to six rows so the combo box doesn't cover other controls when it expands. Private Sub InitializeComboBox() Me.CatCodeComboBox = New System.Windows.Forms.ComboBox Dim conn As New SqlConnection(connString) Dim strSQL As String = "SELECT ict_code FROM inv_itemcategory" Dim da As New SqlDataAdapter(strSQL, conn) Dim ds As New DataSet da.Fill(ds, "inv_itemcategory") With CatCodeComboBox .DataSource = ds.Tables("inv_itemcategory") .DisplayMember = "ict_code" .ValueMember = "ict_code" .SelectedIndex = 0 End With Me.CatCodeComboBox.Location = New System.Drawing.Point(95, 32) Me.CatCodeComboBox.MaxDropDownItems = 5 Me.CatCodeComboBox.DropDownStyle = ComboBoxStyle.DropDown Me.CatCodeComboBox.Name = "CatCodeComboBox" Me.CatCodeComboBox.Size = New System.Drawing.Size(292, 21) Me.CatCodeComboBox.TabIndex = 0 Me.Controls.Add(Me.CatCodeComboBox) End Sub
•
•
Join Date: Nov 2007
Location: ★ Jogja ★
Posts: 2,477
Reputation:
Rep Power: 9
Solved Threads: 215
you didn't make a connection to sql server..
Never tried = Never Know
So, Please do something before post your thread.
* PM Asking will be ignored *
So, Please do something before post your thread.
* PM Asking will be ignored *
![]() |
•
•
•
•
•
•
•
•
DaniWeb VB.NET Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
access activation algos api blogger blogging blogs code code injection combo dani daniweb data debugging development dreamweaver dropdownlist epilepsy fortitude gdata google gpl griefers hackers hope html innovation javascript key linux microsoft module net news openbsd product programming reuse rss serial source struggle tags trial-and-error victory vista web wysiwyg xml
- Error Code 0x80020043 (Apple Hardware)
- Computer keeps crashing- error code help plz (Windows NT / 2000 / XP / 2003)
- Error 'not all code paths return a value' (C#)
- Error Code (Windows NT / 2000 / XP / 2003)
- Error code COOD11CD (Windows NT / 2000 / XP / 2003)
- find out the error in my code (Java)
- deleting registry key for error code 19 (Windows NT / 2000 / XP / 2003)
Other Threads in the VB.NET Forum
- Previous Thread: re using a dataset
- Next Thread: Automatic Copy to Notepad.



Linear Mode