473,698 Members | 2,554 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

populating vb.net listview with datetime data type from sqldatarea

I am using an sqldatareader and trying to add items from a sql select
statement to a listview control. All columns from sql select statement are
added into listview except one column that is a sql datetime data type. I get
a narrowing conversion error when I attempt to add this column to list view,
my syntax is
cmdSearchResult = New SqlCommand(strH itList, cn)
cmdSearchResult .CommandTimeout = 15
cmdSearchResult .CommandType = CommandType.Tex t
sqlDataReader = cmdSearchResult .ExecuteReader( )
Me.LstVwHitList .Items.Add(sqlD ataReader.Item( 0))
Me.LstVwHitList .Items(i).SubIt ems.Add(sqlData Reader.Item(1))
Me.LstVwHitList .Items(i).SubIt ems.Add(sqlData Reader.Item(2))
Me.LstVwHitList .Items(i).SubIt ems.Add(sqlData Reader.Item(3))

item 3 is a datetime data type and it fails here.

Sep 15 '05 #1
0 1380

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

Similar topics

1
1623
by: MrB | last post by:
I am quite new to vb.net. I have been using VBA for years, but an having problems with populating a listview. I have tried many things, including snippets of code from some news groups with no success. I have even purchased a couple of books on vb.net and still do not have it working. I would like to see some example code that will connect to an Access database and populate a listview box with an autonumber field and a couple of text...
1
787
by: J_Max | last post by:
Hello, This might be a really easy question, but... I am developing a simple Smart Device application that uses a listview. I have a function that adds a item to the listview - code is below. I use the type listviewitem, selitem, on one form to modify the listviewitem, using a timer, every second, and use selitem1 to modify items, after they have ended the time on the timer form, from the form that the listview is located - this way I...
13
2067
by: **Developer** | last post by:
I need to sort the columns of a ListView. Some columns contain dates and others contain integers. What I did once before is in the Compare method I tried date and if that failed I did Integer. Seems kinda not nice - is there a better way? Thanks
0
390
by: James | last post by:
I am using an sqldatareader and trying to add items from a sql select statement to a listview control. All columns from sql select statement are added into listview except one column that is a sql datetime data type. I get a narrowing conversion error when I attempt to add this column to list view, my syntax is cmdSearchResult = New SqlCommand(strHitList, cn) cmdSearchResult.CommandTimeout = 15 cmdSearchResult.CommandType =...
3
6040
by: sck10 | last post by:
Hello, I am creating a form for users to enter information about a lab and the members of the lab. I have one form (FormView) that they use to enter information about that lab. The keyvalue is "LabLocation_ID". With an existing lab, they then need to add the members for that lab. So, what I am trying to do is the following. With the FormView of the Lab open, the user will click a button to open a FormView (InsertMode) and add a new...
0
3139
by: Droopy | last post by:
Hi, I got the System.ArgumentOutOfRangeException exception when adding an item in ListView. This ListView (listViewOutput) is used to display messages to user (normal messages and error messages): private void AddOutputMessage (string message) { listViewOutput.BeginUpdate ();
2
6715
by: Lars Erik Nes | last post by:
Hi all. I have a problem. I get all my data from a dataset (not mssql) and in that dataset i have a table called "Activity". In this table i have a few date fields. When i display the dataset "Activity" in a listview the date fields is displayed like : dd.mm.yy 00:00:00. How can i format this date. I do not want the time. Just the date. In my dataset "activity" all date fields are formatted as: dd.mm.yyyy. Why do i get the 00:00:00 ??...
1
1537
by: Dave Hutchings | last post by:
Hi, My problem is this, I have a search screen which creates a query that performs a search on a large database. The results of this search could, if the user requires, return many many rows (20,000)..... In other languages, when faced with this problem, you can run a query and link it to a datasource and link the datasource to a table. You can then set an option called packetrecords to 20. If your grid has 40 rows, then as it populates...
1
4921
by: Patrick | last post by:
Am upgrading an application from VB6 to VB.Net. One of the controls is a ListView that am failing to populate. Am including some of the code for some assistance where I may be going wrong. Private Sub ShowFielgs() Dim f As ListViewItem Dim i As Integer Dim Names as String Dim Arr6() As Object With tbStaffm Dim date1 As Date = Now
0
8612
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9171
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9032
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8880
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7743
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4373
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4625
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3053
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2008
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.