I have the following code: -
Public Class Payrollfinal
-
Private Sub Payrollfinal_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
-
exportfileButton.Enabled = False
-
Dim oCmd As System.Data.SqlClient.SqlCommand
-
Dim oDr As System.Data.SqlClient.SqlDataReader
-
oCmd = New System.Data.SqlClient.SqlCommand
-
Dim _CMD As SqlCommand = New SqlCommand
-
Dim adapter As System.Data.SqlClient.SqlDataAdapter = New System.Data.SqlClient.SqlDataAdapter
-
Dim ds As New DataSet
-
Try
-
adapter.Fill(ds)
-
With oCmd
-
.Connection = New System.Data.SqlClient.SqlConnection("Initial Catalog=mdr;Data Source=xxxxx;uid=xxxxx;password=xxxxx")
-
.Connection.Open()
-
.CommandType = CommandType.StoredProcedure
-
.Parameters.AddWithValue("@payperiodstartdate", payperiodstartdate)
-
.Parameters.AddWithValue("@payperiodenddate", payperiodenddate)
-
.CommandText = "sp_allsum"
-
oDr = .ExecuteReader()
-
oCmd.Connection.Close()
-
End With
-
Catch ex As Exception
-
MessageBox.Show(ex.Message)
-
End Try
-
-
Try
-
Catch ex As Exception
-
MessageBox.Show(ex.Message)
-
oCmd.Connection.Close()
-
End Try
-
exportfileButton.Enabled = True
-
End Sub
-
and when I press the button that this event is connected to, I get the error:
The SelectCommand Property has not been initialized before calling 'Fill'
and I'm thinking that because on my other page, where I'm trying to run multiple queries with this code; -
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
-
Main.payrollButton.Enabled = True
-
Main.exceptionsButton.Enabled = False
-
Dim oCmd As System.Data.SqlClient.SqlCommand
-
oCmd = New System.Data.SqlClient.SqlCommand
-
Dim adapter As System.Data.SqlClient.SqlDataAdapter = New System.Data.SqlClient.SqlDataAdapter
-
Dim ds As New DataSet
-
Try
-
With oCmd
-
.Connection = New System.Data.SqlClient.SqlConnection("Initial Catalog=mdr;Data Source=xxxxx;uid=xxxxx;password=xxxxx")
-
.Connection.Open()
-
.CommandType = CommandType.StoredProcedure
-
.CommandText = "exec sp_opsum @payperiodstartdate = " + payperiodstartdate + ",@payperiodenddate=" + payperiodenddate + ";" + _
-
"exec sp_opintcheck @payperiodstartdate = " + payperiodstartdate + ",@payperiodenddate=" + payperiodenddate + ";" + _
-
"exec sp_opexceptsum @payperiodstartdate = " + payperiodstartdate + ",@payperiodenddate=" + payperiodenddate + ";" + _
-
"exec sp_empsum @payperiodstartdate = " + payperiodstartdate + ",@payperiodenddate=" + payperiodenddate + ";" + _
-
"exec sp_empexceptsum @payperiodstartdate = " + payperiodstartdate + ",@payperiodenddate=" + payperiodenddate + ";"
-
oCmd.Connection.Close()
-
End With
-
Catch ex As Exception
-
MessageBox.Show(ex.Message)
-
End Try
-
-
Try
-
-
Catch ex As Exception
-
MessageBox.Show(ex.Message)
-
oCmd.Connection.Close()
-
End Try
-
Me.Close()
-
End Sub
-
0 1070 Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Denzil |
last post by:
Hi,
I am using the DataView.Sort Property (on a DataView column) to sort
the View based on some condition.
Now the column that I need to sort contains characters and HTML code
that should not be considered when sorting is done. (e.g. -> <B>,
<FONT ...>, " , ' , etc...).
To illustarte:
Example 1
|
by: |
last post by:
This is a semi-advanced question about ASP VBScript 5.0 classes. If you're
knowledegable, please lend a hand!
VBScript class instances can have properties that have objects assigned to
them. Borrowing R.Quinn's example from ASP101:
Public Property Get Authors()
if not isobject(m_Authors) then
set Library = New cLibrary
Call Library.GetAuthorsByBookID(Me.ID)
|
by: Mike |
last post by:
My first simple attempt at using a property. and I get an exception "An
unhandled exception of type 'System.StackOverflowException' occurred in
BalanceOmatic.exe" on line xxx. I have included the property code and the
button event used to set and call the property value. Any help greatly
appreciated.
What am I missing?
|
by: Mervin Williams |
last post by:
I have several tables involved in my application, but the two in question
here are the company and address tables. The company table has
business_address_id and mailing_address_id columns, which are both foreign
keys to the address table.
So, the stored procedure to which my SelectCommand points to reads as:
ALTER PROCEDURE dbo.CompanyInfoByCompanyID
(
@companyid int
|
by: etropic |
last post by:
I am trying to bind two tables to two different list boxes
Ther tables are working as I use them on another page wth no problems
The code is as follows...
private void Page_Load(object sender, System.EventArgs e
oleDbDataAdapter2.Fill( dataSet1)
oleDbDataAdapter4.Fill( dataSet1)
| |
by: M |
last post by:
Hi,
Does SqlDataAdapter always close the connection (assuming connection was
closed before calling Fill()), even if an exception occurs while calling
Fill()?
Example:
try
{
myDataAdapter.Fill(myDataTable);
|
by: CJ Taylor |
last post by:
Hey, how do I use the anchor property?
I have it set to Top, Left, but when I expand the form, it doesn't grow with
it... What am I missing?
Thanks,
CJ
|
by: Zytan |
last post by:
I just wanted a little practice with the WebBrowser control, so I did
the VB guided tour example here in C#:
http://msdn2.microsoft.com/en-us/library/a08t4ke7(VS.80).aspx
The tutorial asks to put a Panel with a Button and TextBox in it, and
a WebBrowser below it. Then, it sets the Panel's Dock property to be
Top. It sets the WebBroswer's Dock property to be Fill.
But, the WebBrowser then fills the entire form! Even though the
Panel's...
|
by: Rachana |
last post by:
Hi,
I am having vb2003-net 1.1
Code was working fine yesterday, today getting error
-----------------------------------------------------------
error:
An unhandled exception of type 'System.Data.SqlClient.SqlException'
occurred in system.data.dll
Additional information: System error.
-----------------------------------------------------------
|
by: Ethan Kennerly |
last post by:
Hello,
There are a lot of Python mailing lists. I hope this is an appropriate one
for a question on properties.
I am relatively inexperienced user of Python. I came to it to prototype
concepts for videogames. Having programmed in C, scripted in Unix shells,
and scripted in a number of proprietary game scripting languages, I'm
impressed at how well Python meets my needs. In almost all respects, it
does what I've been wishing a...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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,...
|
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...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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...
| |
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |