Object reference not set to an instance of an object.

K

kon george

Can somebody assist. I build this code on a dev laptop and copied across
the
entire code to a Windows 2003 server with 1.1 framework. It is basic
ASP.NE
T that uses web service for SQL Server 2000 DB access.

The code works fine on my dev laptop, just not on the non dev machine.

Here is the full error page:

Server Error in '/jobRequest' Application.
------------------------------------------------------------------------
----
----

Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the
cur
rent web request. Please review the stack trace for more information
about t
he error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not
set t
o an instance of an object.

Source Error:

An unhandled exception was generated during the execution of the current
web
request. Information regarding the origin and location of the exception
can
be identified using the exception stack trace below.

Stack Trace:


[NullReferenceException: Object reference not set to an instance of an
objec
t.]
jobRequest.requestProof.Button1_Click(Object sender, EventArgs e)
+125
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108

System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.Rai
s
ePostBackEvent(String eventArgument) +57
System.Web.UI.Page. RaisePostBackEvent(IPostBackEventHandler
sourceControl
, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
+33
System.Web.UI.Page.ProcessRequestMain() +1277

------------------------------------------------------------------------
----
----
Version Information: Microsoft .NET Framework Version:1.1.4322.573;
ASP.NET
Version:1.1.4322.573


AND here is the requestProof snippet:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.E
ventArgs) Handles Button1.Click
'insert code here for database insertion
Dim myJobRequest As New skillsDB.jobRequest

' a web method is called to check whether the name exists or not
Dim checkName As New skillsDB.jobRequest
Dim userNameSet As DataSet = checkName.findUser(Session("Name"))


' if exists then perform and update
If (userNameSet.Tables(0).Rows.Count <> 0) Then
Dim updateSkillsIndex As DataSet =
myJobRequest.userUpdate(Sessi
on("Name"), Session("BadgeID"), Session("Division"),
Session("Location"), Se
ssion("Data"), Session("Voice"), Session("Converged"),
Session("Security"),
Session("Hosting"), Session("ContactCentres"),
Session("Infrastructure"), _

Session("
Applications"), Session("EMC"), Session("D2WProcess"),
Session("CostingSprea
dsheets"), Session("SalesProcess"), Session("TAS"),
Session("ManageRelations
hips"), Session("CustomerFocus"), _

Session("
CommunicationSkills"), Session("DefineBuyingCriteria"),
Session("DecisionMak
ing"), Session("IssueResolution"), Session("BidManagement"),
Session("Vendor
Management"), _

Session("
Proposals"), Session("Negotiation"), Session("Presentation"),
Session("Contr
actWriting"), Session("BusinessCaseWriting"),
Session("FinancialDecisions"),
Session("TransitionManagement"), _

Session("
OperationalManagement"), Session("ProjectManagement"),
Session("TimeManageme
nt"), Session("QualityFocus"), Session("MSWord"), Session("MSProject"),
Sess
ion("SMART"), Session("MSPowerpoint"), _

Session("
MSExcel"), Session("NMS"), Session("OperatingSystems"),
Session("Application
Integration"), Session("ApplicationDevelopment"),
Session("PortalDevelopment
"), Session("DesktopManagement"), _

Session("
EnterpriseDNA"), Session("DataCarriage"), Session("DataVPN"),
Session("Route
rs"), Session("Switches"), Session("ConvergedTechnologies"),
Session("VoiceC
arriage"), Session("PABX"), Session("KeySystems"), Session("IVR"), _

Session("
Firewalls"), Session("IDS"), Session("HIDS"), Session("ITSecurityVPN"),
Sess
ion("Consultancy"))
Session("Result") = "The skills database has been updated
with t
he below details."
'if setSkiilsIndex is not NULL, then take me to my receipt
page
If Not IsDBNull(updateSkillsIndex) Then
Response.Redirect("requestComplete.aspx")
Else
'lblMessage.Text = "Database Save Error, please contact
Mark
Ussher!!!"
End If
Else
Dim setSkillsIndex As DataSet =
myJobRequest.setSkills(Session("
Name"), Session("BadgeID"), Session("Division"), Session("Location"),
Sessio
n("Data"), Session("Voice"), Session("Converged"), Session("Security"),
Sess
ion("Hosting"), Session("ContactCentres"), Session("Infrastructure"), _

Session("
Applications"), Session("EMC"), Session("D2WProcess"),
Session("CostingSprea
dsheets"), Session("SalesProcess"), Session("TAS"),
Session("ManageRelations
hips"), Session("CustomerFocus"), _

Session("
CommunicationSkills"), Session("DefineBuyingCriteria"),
Session("DecisionMak
ing"), Session("IssueResolution"), Session("BidManagement"),
Session("Vendor
Management"), _

Session("
Proposals"), Session("Negotiation"), Session("Presentation"),
Session("Contr
actWriting"), Session("BusinessCaseWriting"),
Session("FinancialDecisions"),
Session("TransitionManagement"), _

Session("
OperationalManagement"), Session("ProjectManagement"),
Session("TimeManageme
nt"), Session("QualityFocus"), Session("MSWord"), Session("MSProject"),
Sess
ion("SMART"), Session("MSPowerpoint"), _

Session("
MSExcel"), Session("NMS"), Session("OperatingSystems"),
Session("Application
Integration"), Session("ApplicationDevelopment"),
Session("PortalDevelopment
"), Session("DesktopManagement"), _

Session("
EnterpriseDNA"), Session("DataCarriage"), Session("DataVPN"),
Session("Route
rs"), Session("Switches"), Session("ConvergedTechnologies"),
Session("VoiceC
arriage"), Session("PABX"), Session("KeySystems"), Session("IVR"), _

Session("
Firewalls"), Session("IDS"), Session("HIDS"), Session("ITSecurityVPN"),
Sess
ion("Consultancy"))
Session("Result") = "Your skills have been created in the
skills
database."
'if setSkiilsIndex is not NULL, then take me to my receipt
page
If Not IsDBNull(setSkillsIndex) Then
Response.Redirect("requestComplete.aspx")
Else
'lblMessage.Text = "Database Save Error, please contact
Mark
Ussher!!!"
End If
End If
End Sub
 
N

Nick Malik [Microsoft]

Your error is probably related to the fact that Session state is disabled by
default on Windows 2003 server

1.. In the Start menu, click Administrative Tools, and then click Internet
Information Services (IIS) Manager.
2.. Double-click your computer name in the left pane, and then right-click
Web Site.
3.. Click Properties in the popup menu.
4.. Select the Home Directory tab, and then click the Configuration
button.
5.. Click App Options, and then click to select the Enable Session State
check box.

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
kon george said:
Can somebody assist. I build this code on a dev laptop and copied across
the
entire code to a Windows 2003 server with 1.1 framework. It is basic
ASP.NE
T that uses web service for SQL Server 2000 DB access.

The code works fine on my dev laptop, just not on the non dev machine.

Here is the full error page:

Server Error in '/jobRequest' Application.
------------------------------------------------------------------------
----
----

Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the
cur
rent web request. Please review the stack trace for more information
about t
he error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not
set t
o an instance of an object.

Source Error:

An unhandled exception was generated during the execution of the current
web
request. Information regarding the origin and location of the exception
can
be identified using the exception stack trace below.

Stack Trace:


[NullReferenceException: Object reference not set to an instance of an
objec
t.]
jobRequest.requestProof.Button1_Click(Object sender, EventArgs e)
+125
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108

System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.Rai
s
ePostBackEvent(String eventArgument) +57
System.Web.UI.Page. RaisePostBackEvent(IPostBackEventHandler
sourceControl
, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
+33
System.Web.UI.Page.ProcessRequestMain() +1277

------------------------------------------------------------------------
----
----
Version Information: Microsoft .NET Framework Version:1.1.4322.573;
ASP.NET
Version:1.1.4322.573


AND here is the requestProof snippet:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.E
ventArgs) Handles Button1.Click
'insert code here for database insertion
Dim myJobRequest As New skillsDB.jobRequest

' a web method is called to check whether the name exists or not
Dim checkName As New skillsDB.jobRequest
Dim userNameSet As DataSet = checkName.findUser(Session("Name"))


' if exists then perform and update
If (userNameSet.Tables(0).Rows.Count <> 0) Then
Dim updateSkillsIndex As DataSet =
myJobRequest.userUpdate(Sessi
on("Name"), Session("BadgeID"), Session("Division"),
Session("Location"), Se
ssion("Data"), Session("Voice"), Session("Converged"),
Session("Security"),
Session("Hosting"), Session("ContactCentres"),
Session("Infrastructure"), _

Session("
Applications"), Session("EMC"), Session("D2WProcess"),
Session("CostingSprea
dsheets"), Session("SalesProcess"), Session("TAS"),
Session("ManageRelations
hips"), Session("CustomerFocus"), _

Session("
CommunicationSkills"), Session("DefineBuyingCriteria"),
Session("DecisionMak
ing"), Session("IssueResolution"), Session("BidManagement"),
Session("Vendor
Management"), _

Session("
Proposals"), Session("Negotiation"), Session("Presentation"),
Session("Contr
actWriting"), Session("BusinessCaseWriting"),
Session("FinancialDecisions"),
Session("TransitionManagement"), _

Session("
OperationalManagement"), Session("ProjectManagement"),
Session("TimeManageme
nt"), Session("QualityFocus"), Session("MSWord"), Session("MSProject"),
Sess
ion("SMART"), Session("MSPowerpoint"), _

Session("
MSExcel"), Session("NMS"), Session("OperatingSystems"),
Session("Application
Integration"), Session("ApplicationDevelopment"),
Session("PortalDevelopment
"), Session("DesktopManagement"), _

Session("
EnterpriseDNA"), Session("DataCarriage"), Session("DataVPN"),
Session("Route
rs"), Session("Switches"), Session("ConvergedTechnologies"),
Session("VoiceC
arriage"), Session("PABX"), Session("KeySystems"), Session("IVR"), _

Session("
Firewalls"), Session("IDS"), Session("HIDS"), Session("ITSecurityVPN"),
Sess
ion("Consultancy"))
Session("Result") = "The skills database has been updated
with t
he below details."
'if setSkiilsIndex is not NULL, then take me to my receipt
page
If Not IsDBNull(updateSkillsIndex) Then
Response.Redirect("requestComplete.aspx")
Else
'lblMessage.Text = "Database Save Error, please contact
Mark
Ussher!!!"
End If
Else
Dim setSkillsIndex As DataSet =
myJobRequest.setSkills(Session("
Name"), Session("BadgeID"), Session("Division"), Session("Location"),
Sessio
n("Data"), Session("Voice"), Session("Converged"), Session("Security"),
Sess
ion("Hosting"), Session("ContactCentres"), Session("Infrastructure"), _

Session("
Applications"), Session("EMC"), Session("D2WProcess"),
Session("CostingSprea
dsheets"), Session("SalesProcess"), Session("TAS"),
Session("ManageRelations
hips"), Session("CustomerFocus"), _

Session("
CommunicationSkills"), Session("DefineBuyingCriteria"),
Session("DecisionMak
ing"), Session("IssueResolution"), Session("BidManagement"),
Session("Vendor
Management"), _

Session("
Proposals"), Session("Negotiation"), Session("Presentation"),
Session("Contr
actWriting"), Session("BusinessCaseWriting"),
Session("FinancialDecisions"),
Session("TransitionManagement"), _

Session("
OperationalManagement"), Session("ProjectManagement"),
Session("TimeManageme
nt"), Session("QualityFocus"), Session("MSWord"), Session("MSProject"),
Sess
ion("SMART"), Session("MSPowerpoint"), _

Session("
MSExcel"), Session("NMS"), Session("OperatingSystems"),
Session("Application
Integration"), Session("ApplicationDevelopment"),
Session("PortalDevelopment
"), Session("DesktopManagement"), _

Session("
EnterpriseDNA"), Session("DataCarriage"), Session("DataVPN"),
Session("Route
rs"), Session("Switches"), Session("ConvergedTechnologies"),
Session("VoiceC
arriage"), Session("PABX"), Session("KeySystems"), Session("IVR"), _

Session("
Firewalls"), Session("IDS"), Session("HIDS"), Session("ITSecurityVPN"),
Sess
ion("Consultancy"))
Session("Result") = "Your skills have been created in the
skills
database."
'if setSkiilsIndex is not NULL, then take me to my receipt
page
If Not IsDBNull(setSkillsIndex) Then
Response.Redirect("requestComplete.aspx")
Else
'lblMessage.Text = "Database Save Error, please contact
Mark
Ussher!!!"
End If
End If
End Sub
 
K

kon george

Hi Nick:

Thanx for the reply, the session state was enabled already with a 20 min
timeout.

I tried the code on an XP box also (with dotNET 1.1 framework, etc) and
I get the exact some issue.

I am just wondering if there is something in my code that I need to
factor in, in consideration of runtime deployment. It appears that my
code works fine on my DEV environment, but where I do not have .NET dev
installed...it does not.

The code I actually provided was my presentation layer, I have isolated
(I beleive) the issue to be in the web services layer, that is the code
I am calling

"Dim checkName As New skillsDB.jobRequest
Dim userNameSet As DataSet = checkName.findUser(Session("Name"))"

where skillsDB is a web reference to a data access layer. The reason is
that when I invoke a web service on the local machine (my web server
which is the runtime environment) it does not work.

Here is some of the code for the web service component, can you see
anything odd:

webservice.asmx file:
---------------------
'This web method calls a method in job.vb module
'to add jobRequest details to the job table in the database
<WebMethod(Description:="This web method calls a method in skills.vb
module to add skill details to the database")> Public Function
setSkills(ByVal name As String, _

ByVal badgeID As String, _

ByVal division As String, _

ByVal location As String, _

ByVal data As String, _

ByVal voice As String, _

ByVal converged As String, _

ByVal security As String, _

ByVal hosting As String, _

ByVal contactcentres As String, _

ByVal infrastructure As String, _

ByVal applications As String, _

ByVal EMC As String, _

ByVal D2Wprocess As String, _

ByVal costingspreadsheets As String, _

ByVal salesprocess As String, _

ByVal TAS As String, _

ByVal managerelationships As String, _

ByVal customerfocus As String, _

ByVal communicationskills As String, _

ByVal definebuyingcriteria As String, _

ByVal decisionmaking As String, _

ByVal issueresolution As String, _

ByVal bidmanagement As String, _

ByVal vendormanagement As String, _

ByVal proposals As String, _

ByVal negotiation As String, _

ByVal presentation As String, _

ByVal contractwriting As String, _

ByVal businesscasewriting As String, _

ByVal financialdecisions As String, _

ByVal transitionmanagement As String, _

ByVal operationalmanagement As String, _

ByVal projectmanagement As String, _

ByVal timemanagement As String, _

ByVal qualityfocus As String, _

ByVal MSWord As String, _

ByVal MSProject As String, _

ByVal SMART As String, _

ByVal MSPowerpoint As String, _

ByVal MSExcel As String, _

ByVal NMS As String, _

ByVal operatingsystems As String, _

ByVal applicationintegration As String, _

ByVal applicationdevelopment As String, _

ByVal portaldevelopment As String, _

ByVal desktopmanagement As String, _

ByVal enterpriseDNA As String, _

ByVal datacarriage As String, _

ByVal dataVPN As String, _

ByVal routers As String, _

ByVal switches As String, _

ByVal convergedtechnologies As String, _

ByVal voicecarriage As String, _

ByVal PABX As String, _

ByVal keysystems As String, _

ByVal IVR As String, _

ByVal firewalls As String, _

ByVal IDS As String, _

ByVal HIDS As String, _

ByVal ITSecurityVPN As String, _

ByVal consultancy As String) As DataSet

setSkills = addSkills(name, badgeID, division, location, data,
voice, converged, security, hosting, contactcentres, infrastructure, _
applications, EMC, D2Wprocess,
costingspreadsheets, salesprocess, TAS, managerelationships,
customerfocus, _
communicationskills, definebuyingcriteria,
decisionmaking, issueresolution, bidmanagement, vendormanagement, _
proposals, negotiation, presentation,
contractwriting, businesscasewriting, financialdecisions,
transitionmanagement, _
operationalmanagement, projectmanagement,
timemanagement, qualityfocus, MSWord, MSProject, SMART, MSPowerpoint, _
MSExcel, NMS, operatingsystems,
applicationintegration, applicationdevelopment, portaldevelopment,
desktopmanagement, _
enterpriseDNA, datacarriage, dataVPN,
routers, switches, convergedtechnologies, voicecarriage, PABX,
keysystems, IVR, _
firewalls, IDS, HIDS, ITSecurityVPN,
consultancy)

End Function

skills.vb class file:
--------------------
Public Function addSkills(ByVal name As String, _
ByVal badgeID As String, _
ByVal division As String, _
ByVal location As String, _
ByVal data As String, _
ByVal voice As String, _
ByVal converged As String, _
ByVal security As String, _
ByVal hosting As String, _
ByVal contactcentres As String, _
ByVal infrastructure As String, _
ByVal applications As String, _
ByVal EMC As String, _
ByVal D2Wprocess As String, _
ByVal costingspreadsheets As String, _
ByVal salesprocess As String, _
ByVal TAS As String, _
ByVal managerelationships As String, _
ByVal customerfocus As String, _
ByVal communicationskills As String, _
ByVal definebuyingcriteria As String,
_
ByVal decisionmaking As String, _
ByVal issueresolution As String, _
ByVal bidmanagement As String, _
ByVal vendormanagement As String, _
ByVal proposals As String, _
ByVal negotiation As String, _
ByVal presentation As String, _
ByVal contractwriting As String, _
ByVal businesscasewriting As String, _
ByVal financialdecisions As String, _
ByVal transitionmanagement As String,
_
ByVal operationalmanagement As String,
_
ByVal projectmanagement As String, _
ByVal timemanagement As String, _
ByVal qualityfocus As String, _
ByVal MSWord As String, _
ByVal MSProject As String, _
ByVal SMART As String, _
ByVal MSPowerpoint As String, _
ByVal MSExcel As String, _
ByVal NMS As String, _
ByVal operatingsystems As String, _
ByVal applicationintegration As
String, _
ByVal applicationdevelopment As
String, _
ByVal portaldevelopment As String, _
ByVal desktopmanagement As String, _
ByVal enterpriseDNA As String, _
ByVal datacarriage As String, _
ByVal dataVPN As String, _
ByVal routers As String, _
ByVal switches As String, _
ByVal convergedtechnologies As String,
_
ByVal voicecarriage As String, _
ByVal PABX As String, _
ByVal keysystems As String, _
ByVal IVR As String, _
ByVal firewalls As String, _
ByVal IDS As String, _
ByVal HIDS As String, _
ByVal ITSecurityVPN As String, _
ByVal consultancy As String) _
As DataSet


Dim skillsDataReader As SqlDataReader
Dim conn As New SqlConnection(cString)
Dim insertSkills As SqlCommand
Dim strSQLQueryInsertSkills As String

Try

' insert command to add record insert in skills table
strSQLQueryInsertSkills = "INSERT INTO skills " _
& "(staffname, badgeID, division, location, data, voice,
converged, security, hosting, contactcentres, infrastructure," _
& " applications, EMC, D2Wprocess, costingspreadsheets,
salesprocess, TAS, managerelationships, customerfocus," _
& " communicationskills, definebuyingcriteria,
decisionmaking, issueresolution, bidmanagement, vendormanagement," _
& " proposals, negotiation, presentation, contractwriting,
businesscasewriting, financialdecisions, transitionmanagement," _
& " operationalmanagement, projectmanagement,
timemanagement, qualityfocus, MSWord, MSProject, SMART, MSPowerpoint," _
& " MSExcel, NMS, operatingsystems, applicationintegration,
applicationdevelopment, portaldevelopment, desktopmanagement," _
& " enterpriseDNA, datacarriage, dataVPN, routers, switches,
convergedtechnologies, voicecarriage, PABX, keysystems, IVR," _
& " firewalls, IDS, HIDS, ITsecurityVPN, consultancy)" _
& " VALUES (@name, @badgeID, @division, @location, @data,
@voice, @converged, @security, @hosting, @contactcentres,
@infrastructure," _
& " @applications, @emc, @D2Wprocess, @costingspreadsheets,
@salesprocess, @Tas, @managerelationships, @customerfocus," _
& " @communicationskills, @definebuyingcriteria,
@decisionmaking, @issueresolution, @bidmanagement, @vendormanagement," _
& " @proposals, @negotiation, @Presentation,
@contractwriting, @businesscasewriting, @financialdecisions,
@transitionmanagement," _
& " @operationalmanagement, @projectmanagement,
@timemanagement, @qualityfocus, @MSWord, @MSProject, @smart,
@MSPowerpoint," _
& " @MSExcel, @NMS, @operatingsystems,
@applicationintegration, @applicationdevelopment, @portaldevelopment,
@desktopmanagement," _
& " @enterpriseDNA, @datacarriage, @dataVPN, @routers,
@switches, @convergedtechnologies, @voicecarriage, @PABX, @keysystems,
@IVR," _
& " @firewalls, @IDS, @HIDS, @ITsecurityVPN, @consultancy)"


'new command object to pass the insert statement
' and identifies connection to use.
insertSkills = New SqlCommand(strSQLQueryInsertSkills, conn)

' insert the parameters for the SQL commands
insertSkills.Parameters.Add(New SqlParameter("@name",
SqlDbType.VarChar))
' value setting of the parameters
insertSkills.Parameters("@name").Value = name

' insert the parameters for the SQL commands
insertSkills.Parameters.Add(New SqlParameter("@badgeID",
SqlDbType.VarChar))
' value setting of the parameters
insertSkills.Parameters("@badgeID").Value = badgeID

' insert the parameters for the SQL commands
insertSkills.Parameters.Add(New SqlParameter("@division",
SqlDbType.VarChar))
' value setting of the parameters
insertSkills.Parameters("@division").Value = division

' insert the parameters for the SQL commands
insertSkills.Parameters.Add(New SqlParameter("@location",
SqlDbType.VarChar))
' value setting of the parameters
insertSkills.Parameters("@location").Value = location

' insert the parameters for the SQL commands
insertSkills.Parameters.Add(New SqlParameter("@data",
SqlDbType.VarChar))
' value setting of the parameters
insertSkills.Parameters("@data").Value = data

' insert the parameters for the SQL commands
insertSkills.Parameters.Add(New SqlParameter("@voice",
SqlDbType.VarChar))
' value setting of the parameters
insertSkills.Parameters("@voice").Value = voice

' insert the parameters for the SQL commands
insertSkills.Parameters.Add(New SqlParameter("@converged",
SqlDbType.VarChar))
' value setting of the parameters
insertSkills.Parameters("@converged").Value = converged

' insert the parameters for the SQL commands
insertSkills.Parameters.Add(New SqlParameter("@security",
SqlDbType.VarChar))
' value setting of the parameters
insertSkills.Parameters("@security").Value = security

' insert the parameters for the SQL commands
insertSkills.Parameters.Add(New SqlParameter("@hosting",
SqlDbType.VarChar))
' value setting of the parameters
insertSkills.Parameters("@hosting").Value = hosting

' insert the parameters for the SQL commands
insertSkills.Parameters.Add(New
SqlParameter("@contactcentres", SqlDbType.VarChar))
' value setting of the parameters
insertSkills.Parameters("@contactcentres").Value =
contactcentres

' insert the parameters for the SQL commands
insertSkills.Parameters.Add(New
SqlParameter("@infrastructure", SqlDbType.VarChar))
' value setting of the parameters
insertSkills.Parameters("@infrastructure").Value =
infrastructure

' insert the parameters for the SQL commands
insertSkills.Parameters.Add(New
SqlParameter("@applications", SqlDbType.VarChar))
' value setting of the parameters
insertSkills.Parameters("@applications").Value =
applications

' insert the parameters for the SQL commands
insertSkills.Parameters.Add(New SqlParameter("@emc",
SqlDbType.VarChar))
' value setting of the parameters
insertSkills.Parameters("@emc").Value = EMC

' insert the parameters for the SQL commands
insertSkills.Parameters.Add(New SqlParameter("@D2Wprocess",
SqlDbType.VarChar))
' value setting of the parameters
insertSkills.Parameters("@D2Wprocess").Value = D2Wprocess

' insert the parameters for the SQL commands
insertSkills.Parameters.Add(New
SqlParameter("@costingspreadsheets", SqlDbType.VarChar))
' value setting of the parameters
insertSkills.Parameters("@costingspreadsheets").Value =
costingspreadsheets

' insert the parameters for the SQL commands
insertSkills.Parameters.Add(New
SqlParameter("@salesprocess", SqlDbType.VarChar))
' value setting of the parameters
insertSkills.Parameters("@salesprocess").Value =
salesprocess

' insert the parameters for the SQL commands
insertSkills.Parameters.Add(New SqlParameter("@Tas",
SqlDbType.VarChar))
' value setting of the parameters
insertSkills.Parameters("@Tas").Value = TAS

' insert the parameters for the SQL commands
insertSkills.Parameters.Add(New
SqlParameter("@managerelationships", SqlDbType.VarChar))
' value setting of the parameters
insertSkills.Parameters("@managerelationships").Value =
managerelationships

' insert the parameters for the SQL commands
insertSkills.Parameters.Add(New
SqlParameter("@customerfocus", SqlDbType.VarChar))
' value setting of the parameters
insertSkills.Parameters("@customerfocus").Value =
customerfocus

' insert the parameters for the SQL commands
insertSkills.Parameters.Add(New
SqlParameter("@communicationskills", SqlDbType.VarChar))
' value setting of the parameters
insertSkills.Parameters("@communicationskills").Value =
communicationskills

' insert the parameters for the SQL commands
insertSkills.Parameters.Add(New
SqlParameter("@definebuyingcriteria", SqlDbType.VarChar))
' value setting of the parameters
insertSkills.Parameters("@definebuyingcriteria").Value =
definebuyingcriteria

' insert the parameters for the SQL commands
insertSkills.Parameters.Add(New
SqlParameter("@decisionmaking", SqlDbType.VarChar))
' value setting of the parameters
insertSkills.Parameters("@decisionmaking").Value =
decisionmaking

' insert the parameters for the SQL commands
insertSkills.Parameters.Add(New
SqlParameter("@issueresolution", SqlDbType.VarChar))
' value setting of the parameters
insertSkills.Parameters("@issueresolution").Value =
issueresolution

' insert the parameters for the SQL commands
insertSkills.Parameters.Add(New
SqlParameter("@bidmanagement", SqlDbType.VarChar))
' value setting of the parameters
insertSkills.Parameters("@bidmanagement").Value =
bidmanagement

' insert the parameters for the SQL commands
insertSkills.Parameters.Add(New
SqlParameter("@vendormanagement", SqlDbType.VarChar))
' value setting of the parameters
insertSkills.Parameters("@vendormanagement").Value =
vendormanagement

' insert the parameters for the SQL commands
insertSkills.Parameters.Add(New SqlParameter("@proposals",
SqlDbType.VarChar))
' value setting of the parameters
insertSkills.Parameters("@proposals").Value = proposals

' insert the parameters for the SQL commands
insertSkills.Parameters.Add(New SqlParameter("@negotiation",
SqlDbType.VarChar))
' value setting of the parameters
insertSkills.Parameters("@negotiation").Value = negotiation

' insert the parameters for the SQL commands
insertSkills.Parameters.Add(New
SqlParameter("@Presentation", SqlDbType.VarChar))
' value setting of the parameters
insertSkills.Parameters("@Presentation").Value =
presentation

' insert the parameters for the SQL commands
insertSkills.Parameters.Add(New
SqlParameter("@contractwriting", SqlDbType.VarChar))
' value setting of the parameters
insertSkills.Parameters("@contractwriting").Value =
contractwriting

' insert the parameters for the SQL commands
insertSkills.Parameters.Add(New
SqlParameter("@businesscasewriting", SqlDbType.VarChar))
' value setting of the parameters
insertSkills.Parameters("@businesscasewriting").Value =
businesscasewriting

' insert the parameters for the SQL commands
insertSkills.Parameters.Add(New
SqlParameter("@financialdecisions", SqlDbType.VarChar))
' value setting of the parameters
insertSkills.Parameters("@financialdecisions").Value =
financialdecisions

' insert the parameters for the SQL commands
insertSkills.Parameters.Add(New
SqlParameter("@transitionmanagement", SqlDbType.VarChar))
' value setting of the parameters
insertSkills.Parameters("@transitionmanagement").Value =
transitionmanagement

' insert the parameters for the SQL commands
insertSkills.Parameters.Add(New
SqlParameter("@operationalmanagement", SqlDbType.VarChar))
' value setting of the parameters
insertSkills.Parameters("@operationalmanagement").Value =
operationalmanagement

' insert the parameters for the SQL commands
insertSkills.Parameters.Add(New
SqlParameter("@projectmanagement", SqlDbType.VarChar))
' value setting of the parameters
insertSkills.Parameters("@projectmanagement").Value =
projectmanagement

' insert the parameters for the SQL commands
insertSkills.Parameters.Add(New
SqlParameter("@timemanagement", SqlDbType.VarChar))
' value setting of the parameters
insertSkills.Parameters("@timemanagement").Value =
timemanagement

' insert the parameters for the SQL commands
insertSkills.Parameters.Add(New
SqlParameter("@qualityfocus", SqlDbType.VarChar))
' value setting of the parameters
insertSkills.Parameters("@qualityfocus").Value =
qualityfocus

' insert the parameters for the SQL commands
insertSkills.Parameters.Add(New SqlParameter("@MSWord",
SqlDbType.VarChar))
' value setting of the parameters
insertSkills.Parameters("@MSWord").Value = MSWord

' insert the parameters for the SQL commands
insertSkills.Parameters.Add(New SqlParameter("@MSProject",
SqlDbType.VarChar))
' value setting of the parameters
insertSkills.Parameters("@MSProject").Value = MSProject

' insert the parameters for the SQL commands
insertSkills.Parameters.Add(New SqlParameter("@smart",
SqlDbType.VarChar))
' value setting of the parameters
insertSkills.Parameters("@smart").Value = SMART

' insert the parameters for the SQL commands
insertSkills.Parameters.Add(New
SqlParameter("@MSPowerpoint", SqlDbType.VarChar))
' value setting of the parameters
insertSkills.Parameters("@MSPowerpoint").Value =
MSPowerpoint

' insert the parameters for the SQL commands
insertSkills.Parameters.Add(New SqlParameter("@MSExcel",
SqlDbType.VarChar))
' value setting of the parameters
insertSkills.Parameters("@MSExcel").Value = MSExcel

' insert the parameters for the SQL commands
insertSkills.Parameters.Add(New SqlParameter("@NMS",
SqlDbType.VarChar))
' value setting of the parameters
insertSkills.Parameters("@NMS").Value = NMS

' insert the parameters for the SQL commands
insertSkills.Parameters.Add(New
SqlParameter("@operatingsystems", SqlDbType.VarChar))
' value setting of the parameters
insertSkills.Parameters("@operatingsystems").Value =
operatingsystems

' insert the parameters for the SQL commands
insertSkills.Parameters.Add(New
SqlParameter("@applicationintegration", SqlDbType.VarChar))
' value setting of the parameters
insertSkills.Parameters("@applicationintegration").Value =
applicationintegration

' insert the parameters for the SQL commands
insertSkills.Parameters.Add(New
SqlParameter("@applicationdevelopment", SqlDbType.VarChar))
' value setting of the parameters
insertSkills.Parameters("@applicationdevelopment").Value =
applicationdevelopment

' insert the parameters for the SQL commands
insertSkills.Parameters.Add(New
SqlParameter("@portaldevelopment", SqlDbType.VarChar))
' value setting of the parameters
insertSkills.Parameters("@portaldevelopment").Value =
portaldevelopment

' insert the parameters for the SQL commands
insertSkills.Parameters.Add(New
SqlParameter("@desktopmanagement", SqlDbType.VarChar))
' value setting of the parameters
insertSkills.Parameters("@desktopmanagement").Value =
desktopmanagement

' insert the parameters for the SQL commands
insertSkills.Parameters.Add(New
SqlParameter("@enterpriseDNA", SqlDbType.VarChar))
' value setting of the parameters
insertSkills.Parameters("@enterpriseDNA").Value =
enterpriseDNA

' insert the parameters for the SQL commands
insertSkills.Parameters.Add(New
SqlParameter("@datacarriage", SqlDbType.VarChar))
' value setting of the parameters
insertSkills.Parameters("@datacarriage").Value =
datacarriage

' insert the parameters for the SQL commands
insertSkills.Parameters.Add(New SqlParameter("@dataVPN",
SqlDbType.VarChar))
' value setting of the parameters
insertSkills.Parameters("@dataVPN").Value = dataVPN

' insert the parameters for the SQL commands
insertSkills.Parameters.Add(New SqlParameter("@routers",
SqlDbType.VarChar))
' value setting of the parameters
insertSkills.Parameters("@routers").Value = routers

' insert the parameters for the SQL commands
insertSkills.Parameters.Add(New SqlParameter("@switches",
SqlDbType.VarChar))
' value setting of the parameters
insertSkills.Parameters("@switches").Value = switches

' insert the parameters for the SQL commands
insertSkills.Parameters.Add(New
SqlParameter("@convergedtechnologies", SqlDbType.VarChar))
' value setting of the parameters
insertSkills.Parameters("@convergedtechnologies").Value =
convergedtechnologies

' insert the parameters for the SQL commands
insertSkills.Parameters.Add(New
SqlParameter("@voicecarriage", SqlDbType.VarChar))
' value setting of the parameters
insertSkills.Parameters("@voicecarriage").Value =
voicecarriage

' insert the parameters for the SQL commands
insertSkills.Parameters.Add(New SqlParameter("@PABX",
SqlDbType.VarChar))
' value setting of the parameters
insertSkills.Parameters("@PABX").Value = PABX

' insert the parameters for the SQL commands
insertSkills.Parameters.Add(New SqlParameter("@keysystems",
SqlDbType.VarChar))
' value setting of the parameters
insertSkills.Parameters("@keysystems").Value = keysystems

' insert the parameters for the SQL commands
insertSkills.Parameters.Add(New SqlParameter("@IVR",
SqlDbType.VarChar))
' value setting of the parameters
insertSkills.Parameters("@IVR").Value = IVR

' insert the parameters for the SQL commands
insertSkills.Parameters.Add(New SqlParameter("@firewalls",
SqlDbType.VarChar))
' value setting of the parameters
insertSkills.Parameters("@firewalls").Value = firewalls

' insert the parameters for the SQL commands
insertSkills.Parameters.Add(New SqlParameter("@IDS",
SqlDbType.VarChar))
' value setting of the parameters
insertSkills.Parameters("@IDS").Value = IDS

' insert the parameters for the SQL commands
insertSkills.Parameters.Add(New SqlParameter("@HIDS",
SqlDbType.VarChar))
' value setting of the parameters
insertSkills.Parameters("@HIDS").Value = HIDS

' insert the parameters for the SQL commands
insertSkills.Parameters.Add(New
SqlParameter("@ITsecurityVPN", SqlDbType.VarChar))
' value setting of the parameters
insertSkills.Parameters("@ITsecurityVPN").Value =
ITSecurityVPN

' insert the parameters for the SQL commands
insertSkills.Parameters.Add(New SqlParameter("@consultancy",
SqlDbType.VarChar))
' value setting of the parameters
insertSkills.Parameters("@consultancy").Value = consultancy

conn.Open()
skillsDataReader =
insertSkills.ExecuteReader(CommandBehavior.CloseConnection)
Catch
Return Nothing
Finally
conn.Close()
End Try

'Try
' now query the categories table to get the category id added
just now
'conn.Open()
'Dim strSQLQueryListGroupID As String
'strSQLQueryListGroupID = "SELECT c_id FROM categories " & _
'"WHERE c_name='" & categoryName & "' "

'Dim Cidadapter As New SqlDataAdapter(strSQLQueryListGroupID,
conn)

'Create Dataset
'Dim Cidset As New DataSet
'Cidadapter.Fill(Cidset, "Categories")

'Return Cidset

'Catch
' Return Nothing
'Finally
' conn.Close()
'End Try

End Function
 
N

Nick Malik [Microsoft]

Dude... Normalize your database! That structure is awful! If the business
ever wants to track a new skill, you will have to modify the database and
perform data conversion. That's not good.

Also, it is a terrible idea to have a single line of code that performs over
60 calls. (Your original post had a line that called UserUpdate and passed
in 60 parameters, each of which was looked up from the Session. To perform
the call, the system has to make each of those session calls and get the
values). This is bad because an error in any ONE of those calls will cause
the debugger to stop on that line... but you won't know which of the 60
calls failed!

This is where structures help. Create a structure that contains all of the
properties that you want and then assign the values, one at a time, into the
structure. This makes debugging a lot easier. You can also pass around the
structure, rather than passing around 60 elements in your parameter lists.

As for your code... you uploaded a large amount of code, but not the
routines that you are calling.

The two lines you posted as being the cause of your problem:
"Dim checkName As New skillsDB.jobRequest
Dim userNameSet As DataSet = checkName.findUser(Session("Name"))"

I assume you know this because you caught the error in the debugger.

At the point where the error is thrown, what is the value of Session("Name")
?
Also, what is the value of skillsDB.URL at that point in time? Is it
pointing to your production web service?


--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
kon george said:
Hi Nick:

Thanx for the reply, the session state was enabled already with a 20 min
timeout.

I tried the code on an XP box also (with dotNET 1.1 framework, etc) and
I get the exact some issue.

I am just wondering if there is something in my code that I need to
factor in, in consideration of runtime deployment. It appears that my
code works fine on my DEV environment, but where I do not have .NET dev
installed...it does not.

The code I actually provided was my presentation layer, I have isolated
(I beleive) the issue to be in the web services layer, that is the code
I am calling

"Dim checkName As New skillsDB.jobRequest
Dim userNameSet As DataSet = checkName.findUser(Session("Name"))"

where skillsDB is a web reference to a data access layer. The reason is
that when I invoke a web service on the local machine (my web server
which is the runtime environment) it does not work.

Here is some of the code for the web service component, can you see
anything odd:

<<heavily clipped>>
 
K

kon george

Hi Nick:

Yes I know my code is dodgy as, but I am not a mainstream developer,
just throwing this together as a favour. I will perhaps find time to
refine the code and assign the vars into a structure.

I have no debug as the code works fine on my dev environment, but not on
any box without dotnet loaded. I only assumed that those two lines of
code were the problem as that is were the application meets my database
access code, that is calls a web method.

The skillsDB.URL points to the localhost (127.0.0.1) where the web
service is running to make the call.

Perhaps my issue is my dodgy code? If I clean it up a little...

Kon.
 
N

Nick Malik [Microsoft]

doesn't make sense. you said that the web service is on production and this
app works on dev. I assume that these are different environments.

If you hit the production ws from your dev box, what do you get?

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
 
K

kon george

I figured out the problem, it was the connector string, it was:

Private cString = "data source=127.0.0.1;initial
catalog=cbeads;integrated security=SSPI;persist security info=False"

I recompiled it as:

Private cString = "packet size=4096;integrated security=SSPI;data
source=IBSWEBDEV;persist security info=True;initial catalog=cbeads"

where IBSWEDBDEV is the hostname of the runtime box. I thought that
127.0.0.1 should have worked though. Perhaps it was the persist security
info being set to false also. Funny as I have other code that works fine
on my dev environment and when I copy to other runtime environments.

I will spend some time cleaning up my code, that is normalize and
structures, just lazy to get this job done. By the way I only have one
dev environment and the production was the runtime where the code did
not originally work.

Thanx for your help Nick.
 
C

Cor Ligthert

Kon,

Did you take the second advise from Nick to find this?

I really would take that advise when you did not.

When we had seen this Nick would have told you it direct, however because
your code you missed it probably yourself completly and did not show it to
us.

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top