473,386 Members | 1,647 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,386 software developers and data experts.

filling listbox from table

cj
This used to work a year ago when I wrote it using SQL Express 2005 on
my pc but I've created the database and tables on our production SQL
Sever 2000 and it doesn't work

What's listed in the listbox is a repeated System.Data.DataRowView

It's been so long since I worked on this and I really don't understand
why it used to work and now doesn't. Of course I had to change the
connection string but that's the only change I made to the code. I
think I got the tables and indexes created on SQL Sever 2000 just like
they were in SQL Express 2005.
KeyWTableDeleteCmd.Connection = HitsDbConn
KeyWTableDeleteCmd.CommandText = "DELETE FROM KeyWordTable
WHERE id = @id"
With KeyWTableDeleteCmd.Parameters
.Add("@id", SqlDbType.Int, 4, "id")
End With
KeyWTableDAdapter.DeleteCommand = KeyWTableDeleteCmd

AllowDataGridUpdate = False
REM read/sort key words
KeyWTableDAdapter.Fill(KeyDs, "KeyWordTable")
KeyDs.Tables("KeyWordTable").DefaultView.Sort = "KeyWord"

REM add keywords to listbox
KeyListBox.DataSource() = KeyDs.Tables("KeyWordTable")
KeyListBox.DisplayMember = "KeyWord"
AllowDataGridUpdate = True
Oct 5 '06 #1
1 1210
cj
never mind. I missed capitalizing a letter in the field name of the new
database. It's fixed.

cj wrote:
This used to work a year ago when I wrote it using SQL Express 2005 on
my pc but I've created the database and tables on our production SQL
Sever 2000 and it doesn't work

What's listed in the listbox is a repeated System.Data.DataRowView

It's been so long since I worked on this and I really don't understand
why it used to work and now doesn't. Of course I had to change the
connection string but that's the only change I made to the code. I
think I got the tables and indexes created on SQL Sever 2000 just like
they were in SQL Express 2005.
KeyWTableDeleteCmd.Connection = HitsDbConn
KeyWTableDeleteCmd.CommandText = "DELETE FROM KeyWordTable WHERE
id = @id"
With KeyWTableDeleteCmd.Parameters
.Add("@id", SqlDbType.Int, 4, "id")
End With
KeyWTableDAdapter.DeleteCommand = KeyWTableDeleteCmd

AllowDataGridUpdate = False
REM read/sort key words
KeyWTableDAdapter.Fill(KeyDs, "KeyWordTable")
KeyDs.Tables("KeyWordTable").DefaultView.Sort = "KeyWord"

REM add keywords to listbox
KeyListBox.DataSource() = KeyDs.Tables("KeyWordTable")
KeyListBox.DisplayMember = "KeyWord"
AllowDataGridUpdate = True
Oct 5 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: JMorrell | last post by:
I’m trying to populate a listbox with data that comes from my SQL server. I’ve created the connection, filled the dataset and loaded the data adapter. Apparently, I’m missing something...
6
by: Chris Leuty | last post by:
I am populating a multiselect Listbox from a dataset, with the content of the listbox filled by one table, and the selections determined from another table. So far, I have been keeping the dataset...
6
by: Bryan Dickerson | last post by:
I'm trying to fill a listbox... ------------------------------ Dim oC As New localhost.Service1 Dim oSR As System.IO.StringReader oSR = New...
1
by: lance2001 | last post by:
Hi, After viewing the entire Visual Basic 2005 Express Edition for Beginners video series, I have begun building a database driven application that will make use of listbox1 (multi-select)...
5
by: markr1000 | last post by:
I must have looked searched in 500+ places that showed up in Google searchs, but not one has an example of what I want to do. I have a Listbox on a User Control because I want to control the...
7
by: Lebbsy | last post by:
I have searched the forum for this but found no match for my search. I would like to have a combo box that does not lookup values from a table but on selecting a value, the value is sent to a...
1
by: mlarsen1982 | last post by:
Hello, I have a quick question regarding filling a list box. Basically I need some assistance for a starting point. I have a form with 4 radio buttons for the user to select, then press next....
9
Vini171285
by: Vini171285 | last post by:
Hi, Actually i am filling a list box from database and depending on change in that list box ,the value corresponding to that selected index should come in the textbox,which should come from another...
3
by: aashishn86 | last post by:
Hi all, I am new to ASP, i am making a page on which i have a list box and a textbox. I have dynamically populated the list box from data on the server, what i want it that , when i select a option...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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,...

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.