hello,
I wanted to populate an array with the data from sql table, but not
sure how to go about it.
This is the array iam using at present, but i dont want to provide the
values. Instead i want to query them from sql table t_holidays.
Dim HolidayList() As Date = {#7/4/2006#, #7/6/2006#, #7/13/2006#,
#7/19/2006#, #12/24/2006#, #12/25/2006#, #12/29/2006#, #1/1/2007#}
Any suggestions how to go about this one. Your time is greatly
appreciated.
cheers, Sharon. 4 9602
Simple example (i assume you have basic knowledge about ADO.NET)
Imports System.Data
Imports System.Data.SqlClient
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
Dim dates As System.Collections.Generic.List(Of DateTime) = GetDates()
End Sub
Private Const ConnectionString As String =
"server=ServerName;uid=UserName;password=Password; database=DatebaseName"
Private Function GetDates() As System.Collections.Generic.List(Of DateTime)
Dim result As New System.Collections.Generic.List(Of DateTime)
Dim connection As New SqlConnection(ConnectionString)
Dim command As New SqlCommand("select DateColumn FROM TableName WHERE
Condition", connection)
Dim reader As SqlDataReader
Try
connection.Open()
reader = command.ExecuteReader()
While reader.Read()
result.Add(reader.GetDateTime(0))
End While
Catch ex As Exception
Throw ex
Finally
connection.Dispose()
End Try
Return result
End Function
End Class
--
Milosz Skalecki
MCP, MCAD
"Sharon" wrote:
hello,
I wanted to populate an array with the data from sql table, but not
sure how to go about it.
This is the array iam using at present, but i dont want to provide the
values. Instead i want to query them from sql table t_holidays.
Dim HolidayList() As Date = {#7/4/2006#, #7/6/2006#, #7/13/2006#,
#7/19/2006#, #12/24/2006#, #12/25/2006#, #12/29/2006#, #1/1/2007#}
Any suggestions how to go about this one. Your time is greatly
appreciated.
cheers, Sharon.
Thanks for the Reply, But its giving me an error
System.Collections.Generic.List is not defined, Please let me know
where did it went wrong.
cheers, Sharon.
Milosz Skalecki wrote:
Simple example (i assume you have basic knowledge about ADO.NET)
Imports System.Data
Imports System.Data.SqlClient
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
Dim dates As System.Collections.Generic.List(Of DateTime) = GetDates()
End Sub
Private Const ConnectionString As String =
"server=ServerName;uid=UserName;password=Password; database=DatebaseName"
Private Function GetDates() As System.Collections.Generic.List(Of DateTime)
Dim result As New System.Collections.Generic.List(Of DateTime)
Dim connection As New SqlConnection(ConnectionString)
Dim command As New SqlCommand("select DateColumn FROM TableName WHERE
Condition", connection)
Dim reader As SqlDataReader
Try
connection.Open()
reader = command.ExecuteReader()
While reader.Read()
result.Add(reader.GetDateTime(0))
End While
Catch ex As Exception
Throw ex
Finally
connection.Dispose()
End Try
Return result
End Function
End Class
--
Milosz Skalecki
MCP, MCAD
"Sharon" wrote:
hello,
I wanted to populate an array with the data from sql table, but not
sure how to go about it.
This is the array iam using at present, but i dont want to provide the
values. Instead i want to query them from sql table t_holidays.
Dim HolidayList() As Date = {#7/4/2006#, #7/6/2006#, #7/13/2006#,
#7/19/2006#, #12/24/2006#, #12/25/2006#, #12/29/2006#, #1/1/2007#}
Any suggestions how to go about this one. Your time is greatly
appreciated.
cheers, Sharon.
I am using .NET Framework version, is this class available in this
version
Milosz Skalecki wrote:
Simple example (i assume you have basic knowledge about ADO.NET)
Imports System.Data
Imports System.Data.SqlClient
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
Dim dates As System.Collections.Generic.List(Of DateTime) = GetDates()
End Sub
Private Const ConnectionString As String =
"server=ServerName;uid=UserName;password=Password; database=DatebaseName"
Private Function GetDates() As System.Collections.Generic.List(Of DateTime)
Dim result As New System.Collections.Generic.List(Of DateTime)
Dim connection As New SqlConnection(ConnectionString)
Dim command As New SqlCommand("select DateColumn FROM TableName WHERE
Condition", connection)
Dim reader As SqlDataReader
Try
connection.Open()
reader = command.ExecuteReader()
While reader.Read()
result.Add(reader.GetDateTime(0))
End While
Catch ex As Exception
Throw ex
Finally
connection.Dispose()
End Try
Return result
End Function
End Class
--
Milosz Skalecki
MCP, MCAD
"Sharon" wrote:
hello,
I wanted to populate an array with the data from sql table, but not
sure how to go about it.
This is the array iam using at present, but i dont want to provide the
values. Instead i want to query them from sql table t_holidays.
Dim HolidayList() As Date = {#7/4/2006#, #7/6/2006#, #7/13/2006#,
#7/19/2006#, #12/24/2006#, #12/25/2006#, #12/29/2006#, #1/1/2007#}
Any suggestions how to go about this one. Your time is greatly
appreciated.
cheers, Sharon.
Howdy,
i automatically assumed you were using framework 2.0. Please use
System.Collections.ArrayList instead of
System.Collections.Generic.List(Of DateTime)
regards
--
Milosz Skalecki
MCP, MCAD
"Sharon" wrote:
I am using .NET Framework version, is this class available in this
version
Milosz Skalecki wrote:
Simple example (i assume you have basic knowledge about ADO.NET)
Imports System.Data
Imports System.Data.SqlClient
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
Dim dates As System.Collections.Generic.List(Of DateTime) = GetDates()
End Sub
Private Const ConnectionString As String =
"server=ServerName;uid=UserName;password=Password; database=DatebaseName"
Private Function GetDates() As System.Collections.Generic.List(Of DateTime)
Dim result As New System.Collections.Generic.List(Of DateTime)
Dim connection As New SqlConnection(ConnectionString)
Dim command As New SqlCommand("select DateColumn FROM TableName WHERE
Condition", connection)
Dim reader As SqlDataReader
Try
connection.Open()
reader = command.ExecuteReader()
While reader.Read()
result.Add(reader.GetDateTime(0))
End While
Catch ex As Exception
Throw ex
Finally
connection.Dispose()
End Try
Return result
End Function
End Class
--
Milosz Skalecki
MCP, MCAD
"Sharon" wrote:
hello,
>
I wanted to populate an array with the data from sql table, but not
sure how to go about it.
>
This is the array iam using at present, but i dont want to provide the
values. Instead i want to query them from sql table t_holidays.
>
Dim HolidayList() As Date = {#7/4/2006#, #7/6/2006#, #7/13/2006#,
#7/19/2006#, #12/24/2006#, #12/25/2006#, #12/29/2006#, #1/1/2007#}
>
Any suggestions how to go about this one. Your time is greatly
appreciated.
>
cheers, Sharon.
>
>
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Sugapablo |
last post by:
Before I go building this, I want to know if it already exists.
I need some PHP code that will read a web page and return all text that
comes between <td></td> tags in an array.
So if there...
|
by: harry |
last post by:
Hi All !
I open a table in Query Analyzer by right clicking on it and
selecting 'Open' and when the data is displayed in the view pane I
would like to be able to edit it. It seems however that...
|
by: gustavo_randich |
last post by:
Hello,
I'm looking for a DB2 workaround on a topic already solved in Oracle:
the problem of mutating tables (which states that a trigger action
cannot read the triggering table's data). Yes, I...
|
by: Jan |
last post by:
Have an SQL create/import script. Running this on SQL would make it
create a table with some values. Can Access2003 somehow use such and
SQL script?
I went into SQL query view to try it out, but...
|
by: Susan Rice |
last post by:
I want to create a readonly array of data, then a readonly array of a
structure. This is data I access but I want it protected against
accidental change. The following is my test code.
#include...
|
by: daqmaneng |
last post by:
does anyone have any suggestions for writing a two dimensional array of
data to a file.
Currently, I have an array of 5 columns, with 1000 elements per array.
I know that I can use a for next...
|
by: jonniethecodeprince |
last post by:
Hi all,
I have trouble getting an array of data stored in a separate javascript file i.e. a file called books.js into a table of data for a .xhtml file.
There are 50 Records in this file....
|
by: Madhur |
last post by:
Hi All,
I would like you help me in creating an array of data types.
I am interested in look at the the data type which looks like this
Array...
|
by: billelev |
last post by:
I have a large array of data (1000 x 40 x 3) that I am inserting into a database table. It is incredibly slow, and so I was wondering if there is a quicker way of inserting array data into a table....
|
by: mbedford |
last post by:
I've built a series of queries that bring together and process data from several different tables and queries and at the end a single query returns a single record based on a selection made in a...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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...
|
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: 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...
|
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,...
| |