By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,740 Members | 844 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,740 IT Pros & Developers. It's quick & easy.

Data Column Names not seen in vb Module

P: n/a
I've created a AlertDataClass below within the class I have tables and column that I've create. In the AlertDataAccess class I'm trying to insert data into my tables. AlertDataAccess is a Module that is trying to insert data into the tables. Within the AlertDataClass is subroutine that init and creates ColumnNames. In invoke the AddDataColumnNames() sub to create the column headers.

Why can't I see the column names in my module that I'm trying to insert data into?
It appears that CriteriaAlert subroutine can not see the table column that have been created. I do initisate the AlertDataClass

Public Class AlertDataClass
' create Dataset and Tables
Public AlertDS As DataSet = New DataSet("AlertTables")
Public EventCriteriaTable As DataTable = AlertDS.Tables.Add("EventCriteria")
Public MinGPSHistoryTable As DataTable = AlertDS.Tables.Add("MinGPSHistory")
Public EventLogTable As DataTable = AlertDS.Tables.Add("EventLog")
Dim AlertVar As New AlertVariables

Public Sub AddDataColumnNames()

'Add Column Names for Criteria and Command Data

'Set Column Properties
Dim CriteriaColumnHeader As DataColumn = New DataColumn
CriteriaColumnHeader.DataType = System.Type.GetType("System.String")
CriteriaColumnHeader.AllowDBNull = False

' Add the Column Header to the table.
CriteriaColumnHeader.ColumnName = "CriteriaID"
EventCriteriaTable.Columns.Add(CriteriaColumnHeade r)
CriteriaColumnHeader.ColumnName = "Min_Num"
EventCriteriaTable.Columns.Add(CriteriaColumnHeade r)
CriteriaColumnHeader.ColumnName = "ReportingFrequenecy"
EventCriteriaTable.Columns.Add(CriteriaColumnHeade r)
CriteriaColumnHeader.ColumnName = "TimeToLiveStartDate"
EventCriteriaTable.Columns.Add(CriteriaColumnHeade r)
CriteriaColumnHeader.ColumnName = "TimeToLiveStartTime"
EventCriteriaTable.Columns.Add(CriteriaColumnHeade r)
CriteriaColumnHeader.ColumnName = "TimeToLiveStopDate"
EventCriteriaTable.Columns.Add(CriteriaColumnHeade r)
CriteriaColumnHeader.ColumnName = "TimeToLiveStopTime"
EventCriteriaTable.Columns.Add(CriteriaColumnHeade r)
end class
Module DataAccessClass

Dim AlertData As New AlertDataClass
Dim AlertVar As New AlertVariables
Dim Alerts = AlertData
Dim MessageProcessing As New SageQuestMailer
Sub CriteriaAlert

AddDataColumnNames()
CriteriaDBConnection.Open()

Dim CriteriaReader As SqlDataReader = CriteriaCMD.ExecuteReader(CommandBehavior.CloseCon nection)

If CriteriaReader.HasRows Then
NoData = False 'Data is available
While CriteriaReader.Read()
' Add Column Names and Row Data to Table

CriteriaRow = AlertData.EventCriteriaTable.NewRow() ' Create a New Row
CriteriaRow("CriteriaID") = CriteriaReader.GetSqlValue(0)
CriteriaRow("Min_Num") = CriteriaReader.GetSqlValue(1)
CriteriaRow("ReportingFrequenecy") = CriteriaReader.GetSqlValue(2)
CriteriaRow("TimeToLiveStartDate") = CriteriaReader.GetSqlValue(3)
CriteriaRow("TimeToLiveStartTime") = CriteriaReader.GetSqlValue(4)
CriteriaRow("TimeToLiveStopDate") = CriteriaReader.GetSqlValue(5)
CriteriaRow("TimeToLiveStopTime") = CriteriaReader.GetSqlValue(6)
end sub
end Module

Thanks

Nov 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Duplicate Post

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing

"Larry Bird" <La*******@discussions.microsoft.com> wrote in message
news:FC**********************************@microsof t.com...
I've created a AlertDataClass below within the class I have tables and column that I've create. In the AlertDataAccess class I'm trying to insert
data into my tables. AlertDataAccess is a Module that is trying to insert
data into the tables. Within the AlertDataClass is subroutine that init and
creates ColumnNames. In invoke the AddDataColumnNames() sub to create the
column headers.
Why can't I see the column names in my module that I'm trying to insert data into?

It appears that CriteriaAlert subroutine can not see the table column that have been created. I do initisate the AlertDataClass
Public Class AlertDataClass
' create Dataset and Tables
Public AlertDS As DataSet = New DataSet("AlertTables")
Public EventCriteriaTable As DataTable = AlertDS.Tables.Add("EventCriteria") Public MinGPSHistoryTable As DataTable = AlertDS.Tables.Add("MinGPSHistory") Public EventLogTable As DataTable = AlertDS.Tables.Add("EventLog")
Dim AlertVar As New AlertVariables

Public Sub AddDataColumnNames()

'Add Column Names for Criteria and Command Data

'Set Column Properties
Dim CriteriaColumnHeader As DataColumn = New DataColumn
CriteriaColumnHeader.DataType = System.Type.GetType("System.String") CriteriaColumnHeader.AllowDBNull = False

' Add the Column Header to the table.
CriteriaColumnHeader.ColumnName = "CriteriaID"
EventCriteriaTable.Columns.Add(CriteriaColumnHeade r)
CriteriaColumnHeader.ColumnName = "Min_Num"
EventCriteriaTable.Columns.Add(CriteriaColumnHeade r)
CriteriaColumnHeader.ColumnName = "ReportingFrequenecy"
EventCriteriaTable.Columns.Add(CriteriaColumnHeade r)
CriteriaColumnHeader.ColumnName = "TimeToLiveStartDate"
EventCriteriaTable.Columns.Add(CriteriaColumnHeade r)
CriteriaColumnHeader.ColumnName = "TimeToLiveStartTime"
EventCriteriaTable.Columns.Add(CriteriaColumnHeade r)
CriteriaColumnHeader.ColumnName = "TimeToLiveStopDate"
EventCriteriaTable.Columns.Add(CriteriaColumnHeade r)
CriteriaColumnHeader.ColumnName = "TimeToLiveStopTime"
EventCriteriaTable.Columns.Add(CriteriaColumnHeade r)
end class
Module DataAccessClass

Dim AlertData As New AlertDataClass
Dim AlertVar As New AlertVariables
Dim Alerts = AlertData
Dim MessageProcessing As New SageQuestMailer
Sub CriteriaAlert

AddDataColumnNames()
CriteriaDBConnection.Open()

Dim CriteriaReader As SqlDataReader = CriteriaCMD.ExecuteReader(CommandBehavior.CloseCon nection)
If CriteriaReader.HasRows Then
NoData = False 'Data is available
While CriteriaReader.Read()
' Add Column Names and Row Data to Table

CriteriaRow = AlertData.EventCriteriaTable.NewRow() ' Create a New Row CriteriaRow("CriteriaID") = CriteriaReader.GetSqlValue(0)
CriteriaRow("Min_Num") = CriteriaReader.GetSqlValue(1)
CriteriaRow("ReportingFrequenecy") = CriteriaReader.GetSqlValue(2) CriteriaRow("TimeToLiveStartDate") = CriteriaReader.GetSqlValue(3) CriteriaRow("TimeToLiveStartTime") = CriteriaReader.GetSqlValue(4) CriteriaRow("TimeToLiveStopDate") = CriteriaReader.GetSqlValue(5) CriteriaRow("TimeToLiveStopTime") = CriteriaReader.GetSqlValue(6) end sub
end Module

Thanks

Nov 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.