Tuesday, March 27, 2012
can not expand table group in internet explorer
I hope one of you encountered this problem..
I have grouped fields on one table object in some report.
In visual studio all is well i can expand the grouping fields to see thier
children and thier data.
The problem appears in internet explorer - under no sircumstances will this
group expand there!
I am left with the upper most grouping field and can not drill down to its
members!
I have tried both to define these aggregating fields by my self
and by the vs wizard . Also i tried the matrix component instead of the
table one.
One interesting fact is that once exported to excell, things return to
normal again..
I can expand groups and drill down correctly.
I have installed sp1 for reporting services and use ie6 on winxp
professional (both client and server).
If you did not encounter this before where will you start looking'
Thanks for your attention
ReaThe driil down capability requires Session cookies be enabled. Change the
Internet Explorer setting to "Allow Session Cookies" and it should work
"Rea Peleg" <rea_p@.afek.co.il> wrote in message
news:uQfy2B8bEHA.1764@.TK2MSFTNGP10.phx.gbl...
> Hey all
> I hope one of you encountered this problem..
> I have grouped fields on one table object in some report.
> In visual studio all is well i can expand the grouping fields to see thier
> children and thier data.
> The problem appears in internet explorer - under no sircumstances will
this
> group expand there!
> I am left with the upper most grouping field and can not drill down to its
> members!
> I have tried both to define these aggregating fields by my self
> and by the vs wizard . Also i tried the matrix component instead of the
> table one.
> One interesting fact is that once exported to excell, things return to
> normal again..
> I can expand groups and drill down correctly.
> I have installed sp1 for reporting services and use ie6 on winxp
> professional (both client and server).
> If you did not encounter this before where will you start looking'
> Thanks for your attention
> Rea
>
>
Sunday, March 25, 2012
Can not create Job on SQL2005
Could not create SQL jobs. Getting Error:
Unable to cast object of type 'Microsoft.SqlServer.Management.Smo.SimpleObjectKey' to type
'Microsoft.SqlServer.Management.Smo.Agent.JobObjectKey'. (Microsoft.SqlServer.Smo)
- Tried several different job types, always same result.
- Installing SP1 or SP2 does not help.
- Installing with or without Integration Service does not help.
Any help is highly appreciated
Thanks.
Try this:
Dim strDBName As String
Dim strJobID As Guid
Dim jobDumpJob As Job
Dim jbsDumpJobStep As JobStep
Dim intStepID As Integer
' Connect to the server
Dim srvMgmtServer As Server
srvMgmtServer = New Server("MyServer")
Dim srvConn As ServerConnection
srvConn = srvMgmtServer.ConnectionContext
srvConn.LoginSecure = True
strDBName = dbDatabase.Name
jobDumpJob = New Job(srvMgmtServer.JobServer, "YourJobName")
jobDumpJob.Description = "Job Description"
jobDumpJob.Category = "[Uncategorized (Local)]"
jobDumpJob.OwnerLoginName = "sa"
jobDumpJob.Create()
strJobID = jobDumpJob.JobID
jbsDumpJobStep = New JobStep(jobDumpJob, "Step 1")
jbsDumpJobStep.DatabaseName = "UserDB"
jbsDumpJobStep.Command = "TSQL command"
jbsDumpJobStep.OnSuccessAction = StepCompletionAction.QuitWithSuccess
jbsDumpJobStep.OnFailAction = StepCompletionAction.QuitWithFailure
jbsDumpJobStep.Create()
intStepID = jbsDumpJobStep.ID
jobDumpJob.ApplyToTargetServer(srvMgmtServer.Name)
jobDumpJob.StartStepID = intStepID
jobDumpJob.Alter()
|||
Hi
I am also having this problem.
Im trying to create a job to run SQL Server Integration Package.
The Code that you have given above. What is that for?
Thanks
|||This code uses SMO in VB.Net to create a job to execute a TSQL command. Browse around in ObjectBrowser and you should find the properties necessary to execute a SSIS package.|||I can execute the SISS Package.
But i want to execute it within a job.
Is there any tutorials for creating jobs that i could look at?
|||for some reason it works on an another machine. I dont no why.|||I figured it out. Despite you could install Management Tool on any computer it will work only on machine that have SQL Server 2005 SP2 installed.
|||Try installing SP2 for the client components on all computers taht run management studio, reboot, then try again from management studio client.|||Identical problems here--also tried the new hotfix as well.
We've held off rolling out SP2 due to these and other errors. Until someone deals with these problems I suppose my company is stuck.
|||Check whether Distributed Transaction Coordinator service is started. If not, start it and try again.|||We have a sql2005 installation that I've created jobs on routinely for months and then today we hit this message. I'm not going to install SP2 just yet since some users report that it doesn't help.
The details from the error message are as follows. Any help would be much appreciated. I deleted all SSIS packages and Jobs with no luck. We've rebooted and cycled services per suggestions from users.
The original error message:
TITLE: Microsoft SQL Server Management Studio
Unable to cast object of type 'Microsoft.SqlServer.Management.Smo.SimpleObjectKey' to type 'Microsoft.SqlServer.Management.Smo.Agent.JobObjectKey'. (Microsoft.SqlServer.Smo)
BUTTONS:
OK
Technical details
===================================
Unable to cast object of type 'Microsoft.SqlServer.Management.Smo.SimpleObjectKey' to type 'Microsoft.SqlServer.Management.Smo.Agent.JobObjectKey'. (Microsoft.SqlServer.Smo)
Program Location:
at Microsoft.SqlServer.Management.Smo.Agent.JobCollection.GetObjectByKey(ObjectKeyBase key)
at Microsoft.SqlServer.Management.Smo.SimpleObjectCollectionBase.Contains(String name)
at Microsoft.SqlServer.Management.SqlManagerUI.JobData.JobExists(String jobName)
at Microsoft.SqlServer.Management.SqlManagerUI.JobData.ApplyChanges()
at Microsoft.SqlServer.Management.SqlManagerUI.JobPropertySheet.DoPreProcessExecution(RunType runType, ExecutionMode& executionResult)
at Microsoft.SqlServer.Management.SqlMgmt.SqlMgmtTreeViewControl.DoPreProcessExecutionAndRunViews(RunType runType)
at Microsoft.SqlServer.Management.SqlMgmt.SqlMgmtTreeViewControl.ExecuteForSql(PreProcessExecutionInfo executionInfo, ExecutionMode& executionResult)
at Microsoft.SqlServer.Management.SqlMgmt.SqlMgmtTreeViewControl.Microsoft.SqlServer.Management.SqlMgmt.IExecutionAwareSqlControlCollection.PreProcessExecution(PreProcessExecutionInfo executionInfo, ExecutionMode& executionResult)
at Microsoft.SqlServer.Management.SqlMgmt.ViewSwitcherControlsManager.RunNow(RunType runType, Object sender)
|||
Hi folks,
I too had the same exact error when trying to schedule a package. After reading numerous posts and forums, some people have said
SP2 solved their problems and some said it didn't.
Here's what I did to get it to work.
On our SQL Server 2005 development machine, we did install SP2
however, that doesn't solve the problem because the problem lies in scheduling your job using Management Studio through your local machine. If you logged onto your SQL 2005 server that has SP2, you should be able to schedule from there. But it's through Management Studio, which I'm guessing most of you are trying to create a job schedule for your packages. Usually, people don't think of upgrading their client tools as well.
I verified this by upgrading my local machine to SP2 for the client tools and was able to successfully schedule. You might also need to upgrade your server machine to SP2 to work as well.
I hope this helps.
-SX
|||I finally uninstalled all SQL related products and services, reinstalled everything, added hot fixes and finally we have two of the three servers working--mostly. There are still occaisional errors, but most seem limited to SSMS' and its UI
I haven't rolled SP2 to production yet and won't be adding any new SQL servers to our mix until this mess settles. I thought we'd be going to some of the better features (like Mirroring) later this year but now it'll be Q1'08 at the earliest.
Haven't had this much fun since SQL2KSP4! Keep smiling....
|||Hello Visgor Allen and others!
Thank you for reporting this problem, and sorry for the problems that you are experiencing.
I'd like to understand this issue better so we can provide guidance to other customers. Can somebody on this thread please provide more details on how to repro this problem:
1) What is the initial configuration on both server and client machines (if different)? Is it SQL Server 2005 RTM or SP1?
2) Does the problem reproduce after upgrading client/server/both machines to SP2?
3) From what machine (client/server) are you trying to create a new job?
Thanks in advance!
|||
Unable to create new jobs in sql 2005, SSIS service is running. Finally i was surfing net for solution and understood need to install SP2 in my machine. But if i need to create new jobs in remote system what should i do.
Please suggest me a solution.
Can not create Job on SQL2005
Could not create SQL jobs. Getting Error:
Unable to cast object of type 'Microsoft.SqlServer.Management.Smo.SimpleObjectKey' to type
'Microsoft.SqlServer.Management.Smo.Agent.JobObjectKey'. (Microsoft.SqlServer.Smo)
- Tried several different job types, always same result.
- Installing SP1 or SP2 does not help.
- Installing with or without Integration Service does not help.
Any help is highly appreciated
Thanks.
Try this:
Dim strDBName As String
Dim strJobID As Guid
Dim jobDumpJob As Job
Dim jbsDumpJobStep As JobStep
Dim intStepID As Integer
' Connect to the server
Dim srvMgmtServer As Server
srvMgmtServer = New Server("MyServer")
Dim srvConn As ServerConnection
srvConn = srvMgmtServer.ConnectionContext
srvConn.LoginSecure = True
strDBName = dbDatabase.Name
jobDumpJob = New Job(srvMgmtServer.JobServer, "YourJobName")
jobDumpJob.Description = "Job Description"
jobDumpJob.Category = "[Uncategorized (Local)]"
jobDumpJob.OwnerLoginName = "sa"
jobDumpJob.Create()
strJobID = jobDumpJob.JobID
jbsDumpJobStep = New JobStep(jobDumpJob, "Step 1")
jbsDumpJobStep.DatabaseName = "UserDB"
jbsDumpJobStep.Command = "TSQL command"
jbsDumpJobStep.OnSuccessAction = StepCompletionAction.QuitWithSuccess
jbsDumpJobStep.OnFailAction = StepCompletionAction.QuitWithFailure
jbsDumpJobStep.Create()
intStepID = jbsDumpJobStep.ID
jobDumpJob.ApplyToTargetServer(srvMgmtServer.Name)
jobDumpJob.StartStepID = intStepID
jobDumpJob.Alter()
Hi
I am also having this problem.
Im trying to create a job to run SQL Server Integration Package.
The Code that you have given above. What is that for?
Thanks
|||This code uses SMO in VB.Net to create a job to execute a TSQL command. Browse around in ObjectBrowser and you should find the properties necessary to execute a SSIS package.|||I can execute the SISS Package.
But i want to execute it within a job.
Is there any tutorials for creating jobs that i could look at?
|||for some reason it works on an another machine. I dont no why.|||I figured it out. Despite you could install Management Tool on any computer it will work only on machine that have SQL Server 2005 SP2 installed.
|||Try installing SP2 for the client components on all computers taht run management studio, reboot, then try again from management studio client.|||Identical problems here--also tried the new hotfix as well.
We've held off rolling out SP2 due to these and other errors. Until someone deals with these problems I suppose my company is stuck.
|||Check whether Distributed Transaction Coordinator service is started. If not, start it and try again.|||We have a sql2005 installation that I've created jobs on routinely for months and then today we hit this message. I'm not going to install SP2 just yet since some users report that it doesn't help.
The details from the error message are as follows. Any help would be much appreciated. I deleted all SSIS packages and Jobs with no luck. We've rebooted and cycled services per suggestions from users.
The original error message:
TITLE: Microsoft SQL Server Management Studio
Unable to cast object of type 'Microsoft.SqlServer.Management.Smo.SimpleObjectKey' to type 'Microsoft.SqlServer.Management.Smo.Agent.JobObjectKey'. (Microsoft.SqlServer.Smo)
BUTTONS:
OK
Technical details
===================================
Unable to cast object of type 'Microsoft.SqlServer.Management.Smo.SimpleObjectKey' to type 'Microsoft.SqlServer.Management.Smo.Agent.JobObjectKey'. (Microsoft.SqlServer.Smo)
Program Location:
at Microsoft.SqlServer.Management.Smo.Agent.JobCollection.GetObjectByKey(ObjectKeyBase key)
at Microsoft.SqlServer.Management.Smo.SimpleObjectCollectionBase.Contains(String name)
at Microsoft.SqlServer.Management.SqlManagerUI.JobData.JobExists(String jobName)
at Microsoft.SqlServer.Management.SqlManagerUI.JobData.ApplyChanges()
at Microsoft.SqlServer.Management.SqlManagerUI.JobPropertySheet.DoPreProcessExecution(RunType runType, ExecutionMode& executionResult)
at Microsoft.SqlServer.Management.SqlMgmt.SqlMgmtTreeViewControl.DoPreProcessExecutionAndRunViews(RunType runType)
at Microsoft.SqlServer.Management.SqlMgmt.SqlMgmtTreeViewControl.ExecuteForSql(PreProcessExecutionInfo executionInfo, ExecutionMode& executionResult)
at Microsoft.SqlServer.Management.SqlMgmt.SqlMgmtTreeViewControl.Microsoft.SqlServer.Management.SqlMgmt.IExecutionAwareSqlControlCollection.PreProcessExecution(PreProcessExecutionInfo executionInfo, ExecutionMode& executionResult)
at Microsoft.SqlServer.Management.SqlMgmt.ViewSwitcherControlsManager.RunNow(RunType runType, Object sender)
Hi folks,
I too had the same exact error when trying to schedule a package. After reading numerous posts and forums, some people have said
SP2 solved their problems and some said it didn't.
Here's what I did to get it to work.
On our SQL Server 2005 development machine, we did install SP2
however, that doesn't solve the problem because the problem lies in scheduling your job using Management Studio through your local machine. If you logged onto your SQL 2005 server that has SP2, you should be able to schedule from there. But it's through Management Studio, which I'm guessing most of you are trying to create a job schedule for your packages. Usually, people don't think of upgrading their client tools as well.
I verified this by upgrading my local machine to SP2 for the client tools and was able to successfully schedule. You might also need to upgrade your server machine to SP2 to work as well.
I hope this helps.
-SX
|||I finally uninstalled all SQL related products and services, reinstalled everything, added hot fixes and finally we have two of the three servers working--mostly. There are still occaisional errors, but most seem limited to SSMS' and its UI
I haven't rolled SP2 to production yet and won't be adding any new SQL servers to our mix until this mess settles. I thought we'd be going to some of the better features (like Mirroring) later this year but now it'll be Q1'08 at the earliest.
Haven't had this much fun since SQL2KSP4! Keep smiling....
|||Hello Visgor Allen and others!
Thank you for reporting this problem, and sorry for the problems that you are experiencing.
I'd like to understand this issue better so we can provide guidance to other customers. Can somebody on this thread please provide more details on how to repro this problem:
1) What is the initial configuration on both server and client machines (if different)? Is it SQL Server 2005 RTM or SP1?
2) Does the problem reproduce after upgrading client/server/both machines to SP2?
3) From what machine (client/server) are you trying to create a new job?
Thanks in advance!
|||Unable to create new jobs in sql 2005, SSIS service is running. Finally i was surfing net for solution and understood need to install SP2 in my machine. But if i need to create new jobs in remote system what should i do.
Please suggest me a solution.
Can not create Job on SQL2005
Could not create SQL jobs. Getting Error:
Unable to cast object of type 'Microsoft.SqlServer.Management.Smo.SimpleObjectKey' to type
'Microsoft.SqlServer.Management.Smo.Agent.JobObjectKey'. (Microsoft.SqlServer.Smo)
- Tried several different job types, always same result.
- Installing SP1 or SP2 does not help.
- Installing with or without Integration Service does not help.
Any help is highly appreciated
Thanks.
Try this:
Dim strDBName As String
Dim strJobID As Guid
Dim jobDumpJob As Job
Dim jbsDumpJobStep As JobStep
Dim intStepID As Integer
' Connect to the server
Dim srvMgmtServer As Server
srvMgmtServer = New Server("MyServer")
Dim srvConn As ServerConnection
srvConn = srvMgmtServer.ConnectionContext
srvConn.LoginSecure = True
strDBName = dbDatabase.Name
jobDumpJob = New Job(srvMgmtServer.JobServer, "YourJobName")
jobDumpJob.Description = "Job Description"
jobDumpJob.Category = "[Uncategorized (Local)]"
jobDumpJob.OwnerLoginName = "sa"
jobDumpJob.Create()
strJobID = jobDumpJob.JobID
jbsDumpJobStep = New JobStep(jobDumpJob, "Step 1")
jbsDumpJobStep.DatabaseName = "UserDB"
jbsDumpJobStep.Command = "TSQL command"
jbsDumpJobStep.OnSuccessAction = StepCompletionAction.QuitWithSuccess
jbsDumpJobStep.OnFailAction = StepCompletionAction.QuitWithFailure
jbsDumpJobStep.Create()
intStepID = jbsDumpJobStep.ID
jobDumpJob.ApplyToTargetServer(srvMgmtServer.Name)
jobDumpJob.StartStepID = intStepID
jobDumpJob.Alter()
Hi
I am also having this problem.
Im trying to create a job to run SQL Server Integration Package.
The Code that you have given above. What is that for?
Thanks
|||This code uses SMO in VB.Net to create a job to execute a TSQL command. Browse around in ObjectBrowser and you should find the properties necessary to execute a SSIS package.|||I can execute the SISS Package.
But i want to execute it within a job.
Is there any tutorials for creating jobs that i could look at?
|||for some reason it works on an another machine. I dont no why.|||I figured it out. Despite you could install Management Tool on any computer it will work only on machine that have SQL Server 2005 SP2 installed.
|||Try installing SP2 for the client components on all computers taht run management studio, reboot, then try again from management studio client.|||Identical problems here--also tried the new hotfix as well.
We've held off rolling out SP2 due to these and other errors. Until someone deals with these problems I suppose my company is stuck.
|||Check whether Distributed Transaction Coordinator service is started. If not, start it and try again.|||We have a sql2005 installation that I've created jobs on routinely for months and then today we hit this message. I'm not going to install SP2 just yet since some users report that it doesn't help.
The details from the error message are as follows. Any help would be much appreciated. I deleted all SSIS packages and Jobs with no luck. We've rebooted and cycled services per suggestions from users.
The original error message:
TITLE: Microsoft SQL Server Management Studio
Unable to cast object of type 'Microsoft.SqlServer.Management.Smo.SimpleObjectKey' to type 'Microsoft.SqlServer.Management.Smo.Agent.JobObjectKey'. (Microsoft.SqlServer.Smo)
BUTTONS:
OK
Technical details
===================================
Unable to cast object of type 'Microsoft.SqlServer.Management.Smo.SimpleObjectKey' to type 'Microsoft.SqlServer.Management.Smo.Agent.JobObjectKey'. (Microsoft.SqlServer.Smo)
Program Location:
at Microsoft.SqlServer.Management.Smo.Agent.JobCollection.GetObjectByKey(ObjectKeyBase key)
at Microsoft.SqlServer.Management.Smo.SimpleObjectCollectionBase.Contains(String name)
at Microsoft.SqlServer.Management.SqlManagerUI.JobData.JobExists(String jobName)
at Microsoft.SqlServer.Management.SqlManagerUI.JobData.ApplyChanges()
at Microsoft.SqlServer.Management.SqlManagerUI.JobPropertySheet.DoPreProcessExecution(RunType runType, ExecutionMode& executionResult)
at Microsoft.SqlServer.Management.SqlMgmt.SqlMgmtTreeViewControl.DoPreProcessExecutionAndRunViews(RunType runType)
at Microsoft.SqlServer.Management.SqlMgmt.SqlMgmtTreeViewControl.ExecuteForSql(PreProcessExecutionInfo executionInfo, ExecutionMode& executionResult)
at Microsoft.SqlServer.Management.SqlMgmt.SqlMgmtTreeViewControl.Microsoft.SqlServer.Management.SqlMgmt.IExecutionAwareSqlControlCollection.PreProcessExecution(PreProcessExecutionInfo executionInfo, ExecutionMode& executionResult)
at Microsoft.SqlServer.Management.SqlMgmt.ViewSwitcherControlsManager.RunNow(RunType runType, Object sender)
Hi folks,
I too had the same exact error when trying to schedule a package. After reading numerous posts and forums, some people have said
SP2 solved their problems and some said it didn't.
Here's what I did to get it to work.
On our SQL Server 2005 development machine, we did install SP2
however, that doesn't solve the problem because the problem lies in scheduling your job using Management Studio through your local machine. If you logged onto your SQL 2005 server that has SP2, you should be able to schedule from there. But it's through Management Studio, which I'm guessing most of you are trying to create a job schedule for your packages. Usually, people don't think of upgrading their client tools as well.
I verified this by upgrading my local machine to SP2 for the client tools and was able to successfully schedule. You might also need to upgrade your server machine to SP2 to work as well.
I hope this helps.
-SX
|||I finally uninstalled all SQL related products and services, reinstalled everything, added hot fixes and finally we have two of the three servers working--mostly. There are still occaisional errors, but most seem limited to SSMS' and its UI
I haven't rolled SP2 to production yet and won't be adding any new SQL servers to our mix until this mess settles. I thought we'd be going to some of the better features (like Mirroring) later this year but now it'll be Q1'08 at the earliest.
Haven't had this much fun since SQL2KSP4! Keep smiling....
|||Hello Visgor Allen and others!
Thank you for reporting this problem, and sorry for the problems that you are experiencing.
I'd like to understand this issue better so we can provide guidance to other customers. Can somebody on this thread please provide more details on how to repro this problem:
1) What is the initial configuration on both server and client machines (if different)? Is it SQL Server 2005 RTM or SP1?
2) Does the problem reproduce after upgrading client/server/both machines to SP2?
3) From what machine (client/server) are you trying to create a new job?
Thanks in advance!
|||Unable to create new jobs in sql 2005, SSIS service is running. Finally i was surfing net for solution and understood need to install SP2 in my machine. But if i need to create new jobs in remote system what should i do.
Please suggest me a solution.
Can not create Job on SQL2005
Could not create SQL jobs. Getting Error:
Unable to cast object of type 'Microsoft.SqlServer.Management.Smo.SimpleObjectKey' to type
'Microsoft.SqlServer.Management.Smo.Agent.JobObjectKey'. (Microsoft.SqlServer.Smo)
- Tried several different job types, always same result.
- Installing SP1 or SP2 does not help.
- Installing with or without Integration Service does not help.
Any help is highly appreciated
Thanks.
Try this:
Dim strDBName As String
Dim strJobID As Guid
Dim jobDumpJob As Job
Dim jbsDumpJobStep As JobStep
Dim intStepID As Integer
' Connect to the server
Dim srvMgmtServer As Server
srvMgmtServer = New Server("MyServer")
Dim srvConn As ServerConnection
srvConn = srvMgmtServer.ConnectionContext
srvConn.LoginSecure = True
strDBName = dbDatabase.Name
jobDumpJob = New Job(srvMgmtServer.JobServer, "YourJobName")
jobDumpJob.Description = "Job Description"
jobDumpJob.Category = "[Uncategorized (Local)]"
jobDumpJob.OwnerLoginName = "sa"
jobDumpJob.Create()
strJobID = jobDumpJob.JobID
jbsDumpJobStep = New JobStep(jobDumpJob, "Step 1")
jbsDumpJobStep.DatabaseName = "UserDB"
jbsDumpJobStep.Command = "TSQL command"
jbsDumpJobStep.OnSuccessAction = StepCompletionAction.QuitWithSuccess
jbsDumpJobStep.OnFailAction = StepCompletionAction.QuitWithFailure
jbsDumpJobStep.Create()
intStepID = jbsDumpJobStep.ID
jobDumpJob.ApplyToTargetServer(srvMgmtServer.Name)
jobDumpJob.StartStepID = intStepID
jobDumpJob.Alter()
Hi
I am also having this problem.
Im trying to create a job to run SQL Server Integration Package.
The Code that you have given above. What is that for?
Thanks
|||This code uses SMO in VB.Net to create a job to execute a TSQL command. Browse around in ObjectBrowser and you should find the properties necessary to execute a SSIS package.|||I can execute the SISS Package.
But i want to execute it within a job.
Is there any tutorials for creating jobs that i could look at?
|||for some reason it works on an another machine. I dont no why.|||I figured it out. Despite you could install Management Tool on any computer it will work only on machine that have SQL Server 2005 SP2 installed.
|||Try installing SP2 for the client components on all computers taht run management studio, reboot, then try again from management studio client.|||Identical problems here--also tried the new hotfix as well.
We've held off rolling out SP2 due to these and other errors. Until someone deals with these problems I suppose my company is stuck.
|||Check whether Distributed Transaction Coordinator service is started. If not, start it and try again.|||We have a sql2005 installation that I've created jobs on routinely for months and then today we hit this message. I'm not going to install SP2 just yet since some users report that it doesn't help.
The details from the error message are as follows. Any help would be much appreciated. I deleted all SSIS packages and Jobs with no luck. We've rebooted and cycled services per suggestions from users.
The original error message:
TITLE: Microsoft SQL Server Management Studio
Unable to cast object of type 'Microsoft.SqlServer.Management.Smo.SimpleObjectKey' to type 'Microsoft.SqlServer.Management.Smo.Agent.JobObjectKey'. (Microsoft.SqlServer.Smo)
BUTTONS:
OK
Technical details
===================================
Unable to cast object of type 'Microsoft.SqlServer.Management.Smo.SimpleObjectKey' to type 'Microsoft.SqlServer.Management.Smo.Agent.JobObjectKey'. (Microsoft.SqlServer.Smo)
Program Location:
at Microsoft.SqlServer.Management.Smo.Agent.JobCollection.GetObjectByKey(ObjectKeyBase key)
at Microsoft.SqlServer.Management.Smo.SimpleObjectCollectionBase.Contains(String name)
at Microsoft.SqlServer.Management.SqlManagerUI.JobData.JobExists(String jobName)
at Microsoft.SqlServer.Management.SqlManagerUI.JobData.ApplyChanges()
at Microsoft.SqlServer.Management.SqlManagerUI.JobPropertySheet.DoPreProcessExecution(RunType runType, ExecutionMode& executionResult)
at Microsoft.SqlServer.Management.SqlMgmt.SqlMgmtTreeViewControl.DoPreProcessExecutionAndRunViews(RunType runType)
at Microsoft.SqlServer.Management.SqlMgmt.SqlMgmtTreeViewControl.ExecuteForSql(PreProcessExecutionInfo executionInfo, ExecutionMode& executionResult)
at Microsoft.SqlServer.Management.SqlMgmt.SqlMgmtTreeViewControl.Microsoft.SqlServer.Management.SqlMgmt.IExecutionAwareSqlControlCollection.PreProcessExecution(PreProcessExecutionInfo executionInfo, ExecutionMode& executionResult)
at Microsoft.SqlServer.Management.SqlMgmt.ViewSwitcherControlsManager.RunNow(RunType runType, Object sender)
Hi folks,
I too had the same exact error when trying to schedule a package. After reading numerous posts and forums, some people have said
SP2 solved their problems and some said it didn't.
Here's what I did to get it to work.
On our SQL Server 2005 development machine, we did install SP2
however, that doesn't solve the problem because the problem lies in scheduling your job using Management Studio through your local machine. If you logged onto your SQL 2005 server that has SP2, you should be able to schedule from there. But it's through Management Studio, which I'm guessing most of you are trying to create a job schedule for your packages. Usually, people don't think of upgrading their client tools as well.
I verified this by upgrading my local machine to SP2 for the client tools and was able to successfully schedule. You might also need to upgrade your server machine to SP2 to work as well.
I hope this helps.
-SX
|||I finally uninstalled all SQL related products and services, reinstalled everything, added hot fixes and finally we have two of the three servers working--mostly. There are still occaisional errors, but most seem limited to SSMS' and its UI
I haven't rolled SP2 to production yet and won't be adding any new SQL servers to our mix until this mess settles. I thought we'd be going to some of the better features (like Mirroring) later this year but now it'll be Q1'08 at the earliest.
Haven't had this much fun since SQL2KSP4! Keep smiling....
|||Hello Visgor Allen and others!
Thank you for reporting this problem, and sorry for the problems that you are experiencing.
I'd like to understand this issue better so we can provide guidance to other customers. Can somebody on this thread please provide more details on how to repro this problem:
1) What is the initial configuration on both server and client machines (if different)? Is it SQL Server 2005 RTM or SP1?
2) Does the problem reproduce after upgrading client/server/both machines to SP2?
3) From what machine (client/server) are you trying to create a new job?
Thanks in advance!
|||Unable to create new jobs in sql 2005, SSIS service is running. Finally i was surfing net for solution and understood need to install SP2 in my machine. But if i need to create new jobs in remote system what should i do.
Please suggest me a solution.
sqlCan not create Job on SQL2005
Could not create SQL jobs. Getting Error:
Unable to cast object of type 'Microsoft.SqlServer.Management.Smo.SimpleObjectKey' to type
'Microsoft.SqlServer.Management.Smo.Agent.JobObjectKey'. (Microsoft.SqlServer.Smo)
- Tried several different job types, always same result.
- Installing SP1 or SP2 does not help.
- Installing with or without Integration Service does not help.
Any help is highly appreciated
Thanks.
Try this:
Dim strDBName As String
Dim strJobID As Guid
Dim jobDumpJob As Job
Dim jbsDumpJobStep As JobStep
Dim intStepID As Integer
' Connect to the server
Dim srvMgmtServer As Server
srvMgmtServer = New Server("MyServer")
Dim srvConn As ServerConnection
srvConn = srvMgmtServer.ConnectionContext
srvConn.LoginSecure = True
strDBName = dbDatabase.Name
jobDumpJob = New Job(srvMgmtServer.JobServer, "YourJobName")
jobDumpJob.Description = "Job Description"
jobDumpJob.Category = "[Uncategorized (Local)]"
jobDumpJob.OwnerLoginName = "sa"
jobDumpJob.Create()
strJobID = jobDumpJob.JobID
jbsDumpJobStep = New JobStep(jobDumpJob, "Step 1")
jbsDumpJobStep.DatabaseName = "UserDB"
jbsDumpJobStep.Command = "TSQL command"
jbsDumpJobStep.OnSuccessAction = StepCompletionAction.QuitWithSuccess
jbsDumpJobStep.OnFailAction = StepCompletionAction.QuitWithFailure
jbsDumpJobStep.Create()
intStepID = jbsDumpJobStep.ID
jobDumpJob.ApplyToTargetServer(srvMgmtServer.Name)
jobDumpJob.StartStepID = intStepID
jobDumpJob.Alter()
Hi
I am also having this problem.
Im trying to create a job to run SQL Server Integration Package.
The Code that you have given above. What is that for?
Thanks
|||This code uses SMO in VB.Net to create a job to execute a TSQL command. Browse around in ObjectBrowser and you should find the properties necessary to execute a SSIS package.|||I can execute the SISS Package.
But i want to execute it within a job.
Is there any tutorials for creating jobs that i could look at?
|||for some reason it works on an another machine. I dont no why.|||I figured it out. Despite you could install Management Tool on any computer it will work only on machine that have SQL Server 2005 SP2 installed.
|||Try installing SP2 for the client components on all computers taht run management studio, reboot, then try again from management studio client.|||Identical problems here--also tried the new hotfix as well.
We've held off rolling out SP2 due to these and other errors. Until someone deals with these problems I suppose my company is stuck.
|||Check whether Distributed Transaction Coordinator service is started. If not, start it and try again.|||We have a sql2005 installation that I've created jobs on routinely for months and then today we hit this message. I'm not going to install SP2 just yet since some users report that it doesn't help.
The details from the error message are as follows. Any help would be much appreciated. I deleted all SSIS packages and Jobs with no luck. We've rebooted and cycled services per suggestions from users.
The original error message:
TITLE: Microsoft SQL Server Management Studio
Unable to cast object of type 'Microsoft.SqlServer.Management.Smo.SimpleObjectKey' to type 'Microsoft.SqlServer.Management.Smo.Agent.JobObjectKey'. (Microsoft.SqlServer.Smo)
BUTTONS:
OK
Technical details
===================================
Unable to cast object of type 'Microsoft.SqlServer.Management.Smo.SimpleObjectKey' to type 'Microsoft.SqlServer.Management.Smo.Agent.JobObjectKey'. (Microsoft.SqlServer.Smo)
Program Location:
at Microsoft.SqlServer.Management.Smo.Agent.JobCollection.GetObjectByKey(ObjectKeyBase key)
at Microsoft.SqlServer.Management.Smo.SimpleObjectCollectionBase.Contains(String name)
at Microsoft.SqlServer.Management.SqlManagerUI.JobData.JobExists(String jobName)
at Microsoft.SqlServer.Management.SqlManagerUI.JobData.ApplyChanges()
at Microsoft.SqlServer.Management.SqlManagerUI.JobPropertySheet.DoPreProcessExecution(RunType runType, ExecutionMode& executionResult)
at Microsoft.SqlServer.Management.SqlMgmt.SqlMgmtTreeViewControl.DoPreProcessExecutionAndRunViews(RunType runType)
at Microsoft.SqlServer.Management.SqlMgmt.SqlMgmtTreeViewControl.ExecuteForSql(PreProcessExecutionInfo executionInfo, ExecutionMode& executionResult)
at Microsoft.SqlServer.Management.SqlMgmt.SqlMgmtTreeViewControl.Microsoft.SqlServer.Management.SqlMgmt.IExecutionAwareSqlControlCollection.PreProcessExecution(PreProcessExecutionInfo executionInfo, ExecutionMode& executionResult)
at Microsoft.SqlServer.Management.SqlMgmt.ViewSwitcherControlsManager.RunNow(RunType runType, Object sender)
Hi folks,
I too had the same exact error when trying to schedule a package. After reading numerous posts and forums, some people have said
SP2 solved their problems and some said it didn't.
Here's what I did to get it to work.
On our SQL Server 2005 development machine, we did install SP2
however, that doesn't solve the problem because the problem lies in scheduling your job using Management Studio through your local machine. If you logged onto your SQL 2005 server that has SP2, you should be able to schedule from there. But it's through Management Studio, which I'm guessing most of you are trying to create a job schedule for your packages. Usually, people don't think of upgrading their client tools as well.
I verified this by upgrading my local machine to SP2 for the client tools and was able to successfully schedule. You might also need to upgrade your server machine to SP2 to work as well.
I hope this helps.
-SX
|||I finally uninstalled all SQL related products and services, reinstalled everything, added hot fixes and finally we have two of the three servers working--mostly. There are still occaisional errors, but most seem limited to SSMS' and its UI
I haven't rolled SP2 to production yet and won't be adding any new SQL servers to our mix until this mess settles. I thought we'd be going to some of the better features (like Mirroring) later this year but now it'll be Q1'08 at the earliest.
Haven't had this much fun since SQL2KSP4! Keep smiling....
|||Hello Visgor Allen and others!
Thank you for reporting this problem, and sorry for the problems that you are experiencing.
I'd like to understand this issue better so we can provide guidance to other customers. Can somebody on this thread please provide more details on how to repro this problem:
1) What is the initial configuration on both server and client machines (if different)? Is it SQL Server 2005 RTM or SP1?
2) Does the problem reproduce after upgrading client/server/both machines to SP2?
3) From what machine (client/server) are you trying to create a new job?
Thanks in advance!
|||Unable to create new jobs in sql 2005, SSIS service is running. Finally i was surfing net for solution and understood need to install SP2 in my machine. But if i need to create new jobs in remote system what should i do.
Please suggest me a solution.
Can not create Job on SQL2005
Could not create SQL jobs. Getting Error:
Unable to cast object of type 'Microsoft.SqlServer.Management.Smo.SimpleObjectKey' to type
'Microsoft.SqlServer.Management.Smo.Agent.JobObjectKey'. (Microsoft.SqlServer.Smo)
- Tried several different job types, always same result.
- Installing SP1 or SP2 does not help.
- Installing with or without Integration Service does not help.
Any help is highly appreciated
Thanks.
Try this:
Dim strDBName As String
Dim strJobID As Guid
Dim jobDumpJob As Job
Dim jbsDumpJobStep As JobStep
Dim intStepID As Integer
' Connect to the server
Dim srvMgmtServer As Server
srvMgmtServer = New Server("MyServer")
Dim srvConn As ServerConnection
srvConn = srvMgmtServer.ConnectionContext
srvConn.LoginSecure = True
strDBName = dbDatabase.Name
jobDumpJob = New Job(srvMgmtServer.JobServer, "YourJobName")
jobDumpJob.Description = "Job Description"
jobDumpJob.Category = "[Uncategorized (Local)]"
jobDumpJob.OwnerLoginName = "sa"
jobDumpJob.Create()
strJobID = jobDumpJob.JobID
jbsDumpJobStep = New JobStep(jobDumpJob, "Step 1")
jbsDumpJobStep.DatabaseName = "UserDB"
jbsDumpJobStep.Command = "TSQL command"
jbsDumpJobStep.OnSuccessAction = StepCompletionAction.QuitWithSuccess
jbsDumpJobStep.OnFailAction = StepCompletionAction.QuitWithFailure
jbsDumpJobStep.Create()
intStepID = jbsDumpJobStep.ID
jobDumpJob.ApplyToTargetServer(srvMgmtServer.Name)
jobDumpJob.StartStepID = intStepID
jobDumpJob.Alter()
Hi
I am also having this problem.
Im trying to create a job to run SQL Server Integration Package.
The Code that you have given above. What is that for?
Thanks
|||This code uses SMO in VB.Net to create a job to execute a TSQL command. Browse around in ObjectBrowser and you should find the properties necessary to execute a SSIS package.|||I can execute the SISS Package.
But i want to execute it within a job.
Is there any tutorials for creating jobs that i could look at?
|||for some reason it works on an another machine. I dont no why.|||I figured it out. Despite you could install Management Tool on any computer it will work only on machine that have SQL Server 2005 SP2 installed.
|||Try installing SP2 for the client components on all computers taht run management studio, reboot, then try again from management studio client.|||Identical problems here--also tried the new hotfix as well.
We've held off rolling out SP2 due to these and other errors. Until someone deals with these problems I suppose my company is stuck.
|||Check whether Distributed Transaction Coordinator service is started. If not, start it and try again.|||We have a sql2005 installation that I've created jobs on routinely for months and then today we hit this message. I'm not going to install SP2 just yet since some users report that it doesn't help.
The details from the error message are as follows. Any help would be much appreciated. I deleted all SSIS packages and Jobs with no luck. We've rebooted and cycled services per suggestions from users.
The original error message:
TITLE: Microsoft SQL Server Management Studio
Unable to cast object of type 'Microsoft.SqlServer.Management.Smo.SimpleObjectKey' to type 'Microsoft.SqlServer.Management.Smo.Agent.JobObjectKey'. (Microsoft.SqlServer.Smo)
BUTTONS:
OK
Technical details
===================================
Unable to cast object of type 'Microsoft.SqlServer.Management.Smo.SimpleObjectKey' to type 'Microsoft.SqlServer.Management.Smo.Agent.JobObjectKey'. (Microsoft.SqlServer.Smo)
Program Location:
at Microsoft.SqlServer.Management.Smo.Agent.JobCollection.GetObjectByKey(ObjectKeyBase key)
at Microsoft.SqlServer.Management.Smo.SimpleObjectCollectionBase.Contains(String name)
at Microsoft.SqlServer.Management.SqlManagerUI.JobData.JobExists(String jobName)
at Microsoft.SqlServer.Management.SqlManagerUI.JobData.ApplyChanges()
at Microsoft.SqlServer.Management.SqlManagerUI.JobPropertySheet.DoPreProcessExecution(RunType runType, ExecutionMode& executionResult)
at Microsoft.SqlServer.Management.SqlMgmt.SqlMgmtTreeViewControl.DoPreProcessExecutionAndRunViews(RunType runType)
at Microsoft.SqlServer.Management.SqlMgmt.SqlMgmtTreeViewControl.ExecuteForSql(PreProcessExecutionInfo executionInfo, ExecutionMode& executionResult)
at Microsoft.SqlServer.Management.SqlMgmt.SqlMgmtTreeViewControl.Microsoft.SqlServer.Management.SqlMgmt.IExecutionAwareSqlControlCollection.PreProcessExecution(PreProcessExecutionInfo executionInfo, ExecutionMode& executionResult)
at Microsoft.SqlServer.Management.SqlMgmt.ViewSwitcherControlsManager.RunNow(RunType runType, Object sender)
Hi folks,
I too had the same exact error when trying to schedule a package. After reading numerous posts and forums, some people have said
SP2 solved their problems and some said it didn't.
Here's what I did to get it to work.
On our SQL Server 2005 development machine, we did install SP2
however, that doesn't solve the problem because the problem lies in scheduling your job using Management Studio through your local machine. If you logged onto your SQL 2005 server that has SP2, you should be able to schedule from there. But it's through Management Studio, which I'm guessing most of you are trying to create a job schedule for your packages. Usually, people don't think of upgrading their client tools as well.
I verified this by upgrading my local machine to SP2 for the client tools and was able to successfully schedule. You might also need to upgrade your server machine to SP2 to work as well.
I hope this helps.
-SX
|||I finally uninstalled all SQL related products and services, reinstalled everything, added hot fixes and finally we have two of the three servers working--mostly. There are still occaisional errors, but most seem limited to SSMS' and its UI
I haven't rolled SP2 to production yet and won't be adding any new SQL servers to our mix until this mess settles. I thought we'd be going to some of the better features (like Mirroring) later this year but now it'll be Q1'08 at the earliest.
Haven't had this much fun since SQL2KSP4! Keep smiling....
|||Hello Visgor Allen and others!
Thank you for reporting this problem, and sorry for the problems that you are experiencing.
I'd like to understand this issue better so we can provide guidance to other customers. Can somebody on this thread please provide more details on how to repro this problem:
1) What is the initial configuration on both server and client machines (if different)? Is it SQL Server 2005 RTM or SP1?
2) Does the problem reproduce after upgrading client/server/both machines to SP2?
3) From what machine (client/server) are you trying to create a new job?
Thanks in advance!
|||Unable to create new jobs in sql 2005, SSIS service is running. Finally i was surfing net for solution and understood need to install SP2 in my machine. But if i need to create new jobs in remote system what should i do.
Please suggest me a solution.
Monday, March 19, 2012
Can MSDE trigger call a .NET remote object?
I wonder if MSDE trigger can call a remote .NET object
,i want to get notify when a new row was added or changed
also if I have an access application(forms etc...) can I still use it with
MSDE?
thanks in advance.
hi Julia,
"Julia" <codewizard@.012.net.il> ha scritto nel messaggio
news:u6ih4$XwEHA.4048@.TK2MSFTNGP15.phx.gbl
> Hi,
> I wonder if MSDE trigger can call a remote .NET object
> ,i want to get notify when a new row was added or changed
>
actually it should not be the case... you could perhaps "shell" out to
server's local resources, but this is not a good practice :D
this is usually not the correct scenario for client server applications...
if you really need something like that, schedule a data refresh from time to
time, say, every hour :D
stop kidding, ok.. perhaps you should rely on other forms of data
investigation..
> also if I have an access application(forms etc...) can I still use it
> with MSDE?
>
usually yes... an .ADP project will manage you connection(s) to a SQL
Server/MSDE database, while the Access project only includes forms
definitions, reports and so on..
http://www.amazon.com/exec/obidos/tg...glance&s=books
... a little dated, but still valuable book by Mary Chipman
Andrea Montanari (Microsoft MVP - SQL Server)
http://www.asql.biz/DbaMgr.shtmhttp://italy.mvps.org
DbaMgr2k ver 0.9.1 - DbaMgr ver 0.55.1
(my vb6+sql-dmo little try to provide MS MSDE 1.0 and MSDE 2000 a visual
interface)
-- remove DMO to reply
Friday, February 24, 2012
Can I turn off or speed up the animation in SSMS?
Is there any way to speed it up or turn it off? It's really impacting my producitivity.
Thanks!
--Wayne
P.S. And never ,never introduce me to the bonehead who put all the animation into Windows and defaulted it to "on" !!!
amen.
I would also LOVE to know if turning the animation off is possible.
|||[HKEY_CURRENT_USER\Software\Microsoft\Microsoft SQL Server\90\Tools
\Shell\General]
"Animations"=dword:00000000
|||[HKEY_CURRENT_USER\Software\Microsoft\Microsoft SQL Server\90\Tools
\Shell\General]
"Animations"=dword:00000000
|||will this help load time?
it takes a full 2 minutes to launch for me, Pentium M 1.8 with 1gb ram
it really pisses me off that I can't use SQL Server Management Studio
Express
I mean-- come on Microsoft (it complains about not being able to install it
since it's already got the full version)
"Sean" <seangorman@.yahoo.com> wrote in message
news:1178134650.847409.151260@.q75g2000hsh.googlegr oups.com...
> [HKEY_CURRENT_USER\Software\Microsoft\Microsoft SQL Server\90\Tools
> \Shell\General]
> "Animations"=dword:00000000
>
|||to speed up load time try this:
change the launch shortcut to this:
"C:\Program Files\Microsoft SQL Server\90\Tools\Binn\VSShell
\Common7\IDE\SqlWb.exe" /nosplash
Also go to tools, options environment, general Change dropdown to
"Open Empty Environment"
Sunday, February 12, 2012
Can I pass a SqlParameterCollection object into a SQL Command
Page 1:
string sql = null;
conn.strConn = connectionstring;sql = "sqlstring";
SqlParameterCollection newcollect = null;
newcollect.Add("@.Switch",1);conn.OpenReader(sql, newcollect);
while (conn.DR.Read())
{
read data onto page here...
}
conn.CloseReader();Page 2 (connection class) :
public void OpenReader(string sql, SqlParameterCollection collect)
{
Conn = new SqlConnection(strConn);
Conn.Open();
Command = new SqlCommand(sql,Conn);Command.Parameters.Add(collect); <--This is the root of my question
Command.CommandTimeout = 300;
// executes sql and fills data reader with data
DR = Command.ExecuteReader();
}
Can you do this? And if so, can anyone tell me why the statement will not return any data? The procedure works perfectly, and will work if I use the standard way of passing the parameters to the command statement.In case anyone runs into the same issue I did, I am posting my solution to this problem. From what I have read, you can not create(instantiate) a new SqlParameterCollection class on a page. If anyone needs to see the solution to return a dataset, just reply to this post, and I will post the dataset results as well. The workaround that I used to solve this problem involves using an Arraylist and passing the arraylist to the connection class:
clsConn conn = new clsConn();
string sql = null;
conn.strConn = connectionstring;
sql = "sqlstring";
SqlParameterCollection newcollect = null;
//newcollect.Add("@.Switch",1); <-- Different
param =new SqlParameter("@.Parameter", SqlDbType.Int, 4, ParameterDirection.Input, false, 10, 0, "Switch", DataRowVersion.Current, ParameterValue); <-- Different
conn.SQLParamCollection.Add(param); <-- Different
conn.OpenReader(sql);
while (conn.DR.Read())
{
read data onto page here...
}
conn.CloseReader();
Page 2 (connection class) :
private SqlConnection Conn; // provides connection for server
private SqlCommand Command; // provides sql command object
private SqlDataAdapter da;
private DataSet ds;
public SqlDataReader DR; // provides data reader for sql
public System.Collections.ArrayList SQLParamCollection = new System.Collections.ArrayList();
public string strConn = null;
public void OpenReader(string ProcedueName)//, System.Collections.ArrayList param)
{
Conn = new SqlConnection(strConn);
Conn.Open();
Command = new SqlCommand(ProcedueName,Conn);
Command.CommandType = CommandType.StoredProcedure;
if(SQLParamCollection.Count > 0)
{
Different-->for(int i=0; i < SQLParamCollection.Count; i++)
{
Different-->Command.Parameters.Add(SQLParamCollection[i]);
}
}
Command.CommandTimeout = 300;
// executes sql and fills data reader with data
DR = Command.ExecuteReader();
}|||You may have to use an ArrayList in this context.
Also, have a look at SqlCommandBuilder.DeriveParameters.
Can I make this code better using SQLParamater object?
I wrote a class to handle my sqlDataReaders:
Namespace CommonFunctions
PublicClass DataAccess
PublicSubNew()
EndSub
Private ConnStrAsString ="connectionString"
PublicFunction returnDR(ByVal strSQLAsString)As SqlClient.SqlDataReader
Dim drAs SqlClient.SqlDataReader
Dim myCnAsNew SqlClient.SqlConnection(ConnStr)
Dim myCmdAsNew SqlClient.SqlCommand(strSQL, myCn)
myCn.Open()
dr = myCmd.ExecuteReader(CommandBehavior.CloseConnection)
Return dr
EndFunction' returnDR
EndClass' Public Class DataAccess
EndNamespace' Namespace CommonFunction
The way I invoke this is:
Imports CommonFunctions
Dim daAsNew DataAccess
Dim sqlDataReaderAs SqlDataReader
Dim strSQLAsNew StringBuilder
strSQL.Append("Some SQL Query")
sqlDataReader = da.returnDR(strSQL.ToString())
DoWhile sqlDataReader.Read()
strVar = sqlDataReader("columnName")
Loop' Do While sqlDataReader.Read()
sqlDataReader.Close()
What I would like to do, is use the SQL Paramater Object instead of passing my method a String. One so that I dont have to explicitly test for SQL Injection and two, cause I have never worked with the SQL Paramater Object before. :)
J
Sure, put this in your class:
PublicFunction returnDR(ByVal cmd AS SqlCommand)As SqlClient.SqlDataReader
Dim drAs SqlClient.SqlDataReader
Dim myCnAsNew SqlClient.SqlConnection(ConnStr)
mycmd.connection=myCn
myCn.Open()
dr = myCmd.ExecuteReader(CommandBehavior.CloseConnection)
Return dr
EndFunction' returnDR
Then you can pass returnDR either a SQLString, or a SqlCommand object.
like this:
dim cmd as new SqlCommand("SELECT * FROM MyTable WHERE ID=@.ID")
cmd.parameters.add("@.ID",sqdbtype.int).value={Some ID}
sqlDataReader = da.returnDR(cmd)
and of course:
sqlDataReader=da.returnDR("SELECT * FROM MyTable WHERE ID=" & {Some ID})
will continue to work as well. That way you can move forward with using SqlCommand's for new queries, and covert the old queries when you have time.
You can then also change your old function to:
PublicFunction returnDR(ByVal sqlcmd AS String)As SqlClient.SqlDataReader
dim cmd as new sqlCommand(sqlcmd)
return returnDR(cmd)
End Function