Showing posts with label calling. Show all posts
Showing posts with label calling. Show all posts

Monday, March 26, 2012

Problems deploying website

My ASP.NET application runs fine within the VS2005 IDE; but, when I deploy to my local machine to try to run it under IIS and calling it up in a browser, I'm getting the following exception:

Exception Details: System.Data.SqlClient.SqlException: Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.

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:


[SqlException (0x80131904): Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.]
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +734979
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +188
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +1838
System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK) +33
System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +628
System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +170
System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +359
System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +28
System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +424
System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +66
System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +496
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +82
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +105
System.Data.SqlClient.SqlConnection.Open() +111
System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +121
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +137
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) +83
System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +1770
System.Web.UI.WebControls.ListControl.OnDataBinding(EventArgs e) +92
System.Web.UI.WebControls.ListControl.PerformSelect() +31
System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +70
System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82
System.Web.UI.WebControls.ListControl.OnPreRender(EventArgs e) +26
System.Web.UI.Control.PreRenderRecursiveInternal() +77
System.Web.UI.Control.PreRenderRecursiveInternal() +161
System.Web.UI.Control.PreRenderRecursiveInternal() +161
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1360

I'm a novice at this and really need some help. What stupid newbie mistake am I making here? Thanks in advance for any guidance/assistance rendered.

When you deplyed the app you left the same SQL trusted connection, and most probably there is no local SQL server running in the same machine. Make sure to change the SQL string to the IP, username and password of the database and will work really well

Al

|||

I remember I got this problem too when I did my first try. It seems that your are using trusted connection, you need assign the domain user in your database with appropriate access right. Or you can create a database user in the database to use standard User/password connection method in your database is in mixed mode..

You can easily find the syntax for the connection string. As to create user in database, you need to create a login account under Security on the Server, in the database, you assign this user for access under database security tab.

Limno

Wednesday, March 21, 2012

Problems connecting to server using Management Studio

Hi all,
I got this problem which makes me struggle in the last few days.
I am able to connect to my local server using a query analyzer or calling sql commands in a window application, but there's no way I can access it in Management Studio: by clicking "Connect" it just waits forever, and it doesn't respond to any other command (it must be shut by terminating the process)
Got any hints?

Thanks

Mauro

Try restarting the sql services may be your server is in hunged state......but i am not sure if that would solve the problem

|||Unfortunately, it doesn't do the trick... in fact, it's like Manag. Studio is able to connect to the server (I can see the list of databases in advanced options) but it doesn't show the result afterwards. Could it be a security/account problem?

Thanks

M|||Hi again,
just another hint trying to understand what's going on.
I just spent a couple of hours removing both the server and the client components and install it again, but the problems remains. Does configuration survive removal? Or should I look somewhere else?

Thanks

Mauro
|||From Management Studio are u trying to connect using Windows authentication or SQL authentication?
|||Both actually. And the result is the same connecting to a local or remote machine, that's why I am quite curious about this error (that in fact makes development harder... )

Mauro

Problems connecting to server using Management Studio

Hi all,
I got this problem which makes me struggle in the last few days.
I am able to connect to my local server using a query analyzer or calling sql commands in a window application, but there's no way I can access it in Management Studio: by clicking "Connect" it just waits forever, and it doesn't respond to any other command (it must be shut by terminating the process)
Got any hints?

Thanks

Mauro

Try restarting the sql services may be your server is in hunged state......but i am not sure if that would solve the problem

|||Unfortunately, it doesn't do the trick... in fact, it's like Manag. Studio is able to connect to the server (I can see the list of databases in advanced options) but it doesn't show the result afterwards. Could it be a security/account problem?

Thanks

M|||Hi again,
just another hint trying to understand what's going on.
I just spent a couple of hours removing both the server and the client components and install it again, but the problems remains. Does configuration survive removal? Or should I look somewhere else?

Thanks

Mauro
|||From Management Studio are u trying to connect using Windows authentication or SQL authentication?
|||Both actually. And the result is the same connecting to a local or remote machine, that's why I am quite curious about this error (that in fact makes development harder... )

Mauro

Problems calling packages from package.

John
I think you will be better to put the question to DTS.newsgroup and also
look at www.sqldts.com .
Personally , I have been calling DTS Package from stored procedure which is
accepted a parameter for GV.
"John Peterson" <j0hnp@.comcast.net> wrote in message
news:OSDjL$ETEHA.2480@.TK2MSFTNGP10.phx.gbl...
> (SQL Server 2000, SP3a)
> Hello all!
> I have a DTS package, that I'll call "A", which calls another package "B".
In A's Global
> Variable (GV) space, I'm defining the following variables:
> SourceServer
> SourceDatabase
> SourceUser
> SourcePassword
> DestinationServer
> DestinationDatabase
> DestinationUser
> DestinationPassword
> I also define these same GVs in B.
> I have A define the values for the GVs and I believe that they should
"propagate" to B by
> placing these variables in the "Outer Package Global Variables" tab.
> However, when I try to change a value from A, it's like B "remembers" the
last successful
> value that was used (it's not picking up the changed value).
> Am I doing something wrong with respect to GVs and packages calling other
packages?
> Thanks!
> John Peterson
>Thanks Uri...however, it *seems* like it's not working correctly in my case.
:-(
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:O3NZtGFTEHA.2944@.tk2msftngp13.phx.gbl...
> John
> I think you will be better to put the question to DTS.newsgroup and also
> look at www.sqldts.com .
> Personally , I have been calling DTS Package from stored procedure which i
s
> accepted a parameter for GV.
>
> "John Peterson" <j0hnp@.comcast.net> wrote in message
> news:OSDjL$ETEHA.2480@.TK2MSFTNGP10.phx.gbl...
> In A's Global
> "propagate" to B by
> last successful
> packages?
>|||A better question might be, what exactly do the two tabs do? That is, if I
want to
propagate my out (caller) package's GVs to the inner (callee), do I do that
from the Outer
Package tab? Or should that be done from the Inner Package tab?
"John Peterson" <j0hnp@.comcast.net> wrote in message
news:eyt8UOFTEHA.2692@.TK2MSFTNGP09.phx.gbl...
> Thanks Uri...however, it *seems* like it's not working correctly in my cas
e. :-(
>
> "Uri Dimant" <urid@.iscar.co.il> wrote in message
> news:O3NZtGFTEHA.2944@.tk2msftngp13.phx.gbl...
>|||From this article: 47.html" target="_blank">http://www.winnetmag.com/SQLServer/...
47.html
<Quote>
Inside the Execute Package task, you can easily pass global variables to the
child
package, as Figure 1 shows. If you click the Inner Package Global Variables
tab in the
Execute Package task, DTS scans the child package for any global variables t
hat it
expects, and you can set them to your own values. Inner global variables let
you set the
global variables for the child package from the Execute Package task. Inner
global
variables are useful when you're calling auditing packages and you want to p
XXX to the
child package certain errors based on events in the parent package. Outer gl
obal variables
send global variables from the parent package to the child package. If a glo
bal variable
exists in the child package, DTS updates the child's global variable to the
parent's
value. If the global variable doesn't exist in the child package, DTS create
s it.
</Quote>
It would *seem* that my understanding of this is accurate. Though, clearly
I'm still
doing something wrong...
"John Peterson" <j0hnp@.comcast.net> wrote in message
news:OvKJxQFTEHA.2692@.TK2MSFTNGP09.phx.gbl...
> A better question might be, what exactly do the two tabs do? That is, if
I want to
> propagate my out (caller) package's GVs to the inner (callee), do I do that from t
he
Outer
> Package tab? Or should that be done from the Inner Package tab?
>
> "John Peterson" <j0hnp@.comcast.net> wrote in message
> news:eyt8UOFTEHA.2692@.TK2MSFTNGP09.phx.gbl...
>

Problems calling packages from package.

John
I think you will be better to put the question to DTS.newsgroup and also
look at www.sqldts.com .
Personally , I have been calling DTS Package from stored procedure which is
accepted a parameter for GV.
"John Peterson" <j0hnp@.comcast.net> wrote in message
news:OSDjL$ETEHA.2480@.TK2MSFTNGP10.phx.gbl...
> (SQL Server 2000, SP3a)
> Hello all!
> I have a DTS package, that I'll call "A", which calls another package "B".
In A's Global
> Variable (GV) space, I'm defining the following variables:
> SourceServer
> SourceDatabase
> SourceUser
> SourcePassword
> DestinationServer
> DestinationDatabase
> DestinationUser
> DestinationPassword
> I also define these same GVs in B.
> I have A define the values for the GVs and I believe that they should
"propagate" to B by
> placing these variables in the "Outer Package Global Variables" tab.
> However, when I try to change a value from A, it's like B "remembers" the
last successful
> value that was used (it's not picking up the changed value).
> Am I doing something wrong with respect to GVs and packages calling other
packages?
> Thanks!
> John Peterson
>
Thanks Uri...however, it *seems* like it's not working correctly in my case. :-(
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:O3NZtGFTEHA.2944@.tk2msftngp13.phx.gbl...
> John
> I think you will be better to put the question to DTS.newsgroup and also
> look at www.sqldts.com .
> Personally , I have been calling DTS Package from stored procedure which is
> accepted a parameter for GV.
>
> "John Peterson" <j0hnp@.comcast.net> wrote in message
> news:OSDjL$ETEHA.2480@.TK2MSFTNGP10.phx.gbl...
> In A's Global
> "propagate" to B by
> last successful
> packages?
>
|||A better question might be, what exactly do the two tabs do? That is, if I want to
propagate my out (caller) package's GVs to the inner (callee), do I do that from the Outer
Package tab? Or should that be done from the Inner Package tab?
"John Peterson" <j0hnp@.comcast.net> wrote in message
news:eyt8UOFTEHA.2692@.TK2MSFTNGP09.phx.gbl...
> Thanks Uri...however, it *seems* like it's not working correctly in my case. :-(
>
> "Uri Dimant" <urid@.iscar.co.il> wrote in message
> news:O3NZtGFTEHA.2944@.tk2msftngp13.phx.gbl...
>
|||From this article: http://www.winnetmag.com/SQLServer/A...747/19747.html
<Quote>
Inside the Execute Package task, you can easily pass global variables to the child
package, as Figure 1 shows. If you click the Inner Package Global Variables tab in the
Execute Package task, DTS scans the child package for any global variables that it
expects, and you can set them to your own values. Inner global variables let you set the
global variables for the child package from the Execute Package task. Inner global
variables are useful when you're calling auditing packages and you want to pass to the
child package certain errors based on events in the parent package. Outer global variables
send global variables from the parent package to the child package. If a global variable
exists in the child package, DTS updates the child's global variable to the parent's
value. If the global variable doesn't exist in the child package, DTS creates it.
</Quote>
It would *seem* that my understanding of this is accurate. Though, clearly I'm still
doing something wrong...
"John Peterson" <j0hnp@.comcast.net> wrote in message
news:OvKJxQFTEHA.2692@.TK2MSFTNGP09.phx.gbl...
> A better question might be, what exactly do the two tabs do? That is, if I want to
> propagate my out (caller) package's GVs to the inner (callee), do I do that from the
Outer
> Package tab? Or should that be done from the Inner Package tab?
>
> "John Peterson" <j0hnp@.comcast.net> wrote in message
> news:eyt8UOFTEHA.2692@.TK2MSFTNGP09.phx.gbl...
>

Problem's calling custom assembly

I have a custom assembly that i'm trying to get tied into my report.
the problem is when i try to call it i get the error that the class is
not defined
I have the class in the references tab and the class name and instance
name both have a name.
here's the error I'm getting
Error 1 [rsCompilerErrorInClassInstanceDeclaration] Error in class
instance declaration for class Assembly_1: [BC30002] Type '[ClassName]'
is not defined. [Project folder]\[reportname].rdl 0 0Mathias,
Can you provide exactly what you have entered in on the references tab?
Also supply the line(s) of code that are calling the assembly. Have you
been successful with other assemblies?
Thanks
"Mathias" <mathias.helbach@.gmail.com> wrote in message
news:1137693941.096073.183720@.g47g2000cwa.googlegroups.com:
> I have a custom assembly that i'm trying to get tied into my report.
> the problem is when i try to call it i get the error that the class is
> not defined
> I have the class in the references tab and the class name and instance
> name both have a name.
> here's the error I'm getting
> Error 1 [rsCompilerErrorInClassInstanceDeclaration] Error in class
> instance declaration for class Assembly_1: [BC30002] Type '[ClassName]'
> is not defined. [Project folder]\[reportname].rdl 0 0
Bret Updegraff, MCAD,MCSD,MCDBA
Microsoft MVP - SQL Server
Crowe Chizek and Company LLC
President - Indianapolis Professional Association for SQL Server
Join our SQL Server Community http;//www.IndyPASS.org
317.208.2538 - FAX (317.706.2660) -BUpdegraff@.CroweChizek.com|||I tried this once as well with no luck. Are the Classes supposed to drop
down for selection after you pick an assembly?
--
William Stacey [MVP]
"Bret Updegraff" <bupdegraff@.crowechizek.com> wrote in message
news:Oi1x6wSHGHA.240@.TK2MSFTNGP11.phx.gbl...
| Mathias,
|
| Can you provide exactly what you have entered in on the references tab?
| Also supply the line(s) of code that are calling the assembly. Have you
| been successful with other assemblies?
|
|
| Thanks
|
| "Mathias" <mathias.helbach@.gmail.com> wrote in message
| news:1137693941.096073.183720@.g47g2000cwa.googlegroups.com:
|
| > I have a custom assembly that i'm trying to get tied into my report.
| > the problem is when i try to call it i get the error that the class is
| > not defined
| >
| > I have the class in the references tab and the class name and instance
| > name both have a name.
| >
| > here's the error I'm getting
| >
| > Error 1 [rsCompilerErrorInClassInstanceDeclaration] Error in class
| > instance declaration for class Assembly_1: [BC30002] Type '[ClassName]'
| > is not defined. [Project folder]\[reportname].rdl 0 0
|
|
| --
| Bret Updegraff, MCAD,MCSD,MCDBA
| Microsoft MVP - SQL Server
| Crowe Chizek and Company LLC
| President - Indianapolis Professional Association for SQL Server
| Join our SQL Server Community http;//www.IndyPASS.org
| 317.208.2538 - FAX (317.706.2660) -BUpdegraff@.CroweChizek.com
||||Bret
I browsed to the folder where the .dll file was selected it and clicked
ok it inserted this line into the assembly name filed
ScoreCardAssembly, Version=0.0.0.0, Culture=neutral,
PublicKeyToken=null
I then named the class Assembly_1 and the instance name Assembly
on the rdl page i called the class with this line of code.
=code.Assembly.HeadCount(Parameters!OfficeID.Value,Parameters!SelectedYear.Value)

Problems calling an SP with SQL Server ( EXECUTE permission denied )

Hi,
I'm trying to test an SP with SQL Query Analyser from my client db an
it gives me this error :
[Microsoft][ODBC SQL Server Driver][SQL Server]EXECUTE permission
denied on object 'sp_sdidebug', database 'master', owner 'dbo'.
I'm using Microsoft SQL SE SP4 and i'm new to it. I read on gg forums
that you have to execute sp_sdidebug with the 'legacy_on' parameter and
you need EXECUTE permission on sp_sdidebug. How do you do that !
Need help ! Thanks !
Olivier
To grant permission, you can use:
GRANT EXECUTE ON sp_sdidebug TO <YourUser>
To enable it for legacy clients, use:
EXEC sp_sdidebug 'legacy_on'
-Sue
On 14 Feb 2005 06:24:02 -0800, "OliE" <olie.rej@.gmail.com>
wrote:

>Hi,
>I'm trying to test an SP with SQL Query Analyser from my client db an
>it gives me this error :
>[Microsoft][ODBC SQL Server Driver][SQL Server]EXECUTE permission
>denied on object 'sp_sdidebug', database 'master', owner 'dbo'.
>I'm using Microsoft SQL SE SP4 and i'm new to it. I read on gg forums
>that you have to execute sp_sdidebug with the 'legacy_on' parameter and
>you need EXECUTE permission on sp_sdidebug. How do you do that !
>Need help ! Thanks !
>Olivier
sql

Problems calling an SP with SQL Server ( EXECUTE permission denied )

Hi,
I'm trying to test an SP with SQL Query Analyser from my client db an
it gives me this error :
[Microsoft][ODBC SQL Server Driver][SQL Server]EXECUTE permissio
n
denied on object 'sp_sdidebug', database 'master', owner 'dbo'.
I'm using Microsoft SQL SE SP4 and i'm new to it. I read on gg forums
that you have to execute sp_sdidebug with the 'legacy_on' parameter and
you need EXECUTE permission on sp_sdidebug. How do you do that !
Need help ! Thanks !
OlivierTo grant permission, you can use:
GRANT EXECUTE ON sp_sdidebug TO <YourUser>
To enable it for legacy clients, use:
EXEC sp_sdidebug 'legacy_on'
-Sue
On 14 Feb 2005 06:24:02 -0800, "OliE" <olie.rej@.gmail.com>
wrote:

>Hi,
>I'm trying to test an SP with SQL Query Analyser from my client db an
>it gives me this error :
>[Microsoft][ODBC SQL Server Driver][SQL Server]EXECUTE permissi
on
>denied on object 'sp_sdidebug', database 'master', owner 'dbo'.
>I'm using Microsoft SQL SE SP4 and i'm new to it. I read on gg forums
>that you have to execute sp_sdidebug with the 'legacy_on' parameter and
>you need EXECUTE permission on sp_sdidebug. How do you do that !
>Need help ! Thanks !
>Olivier

Problems calling a stored procedures depending on parameters

Hi guys, hoping one of you may be able to help me out. I am using VS 2005, and VB.net for a Windows application.

I have a table in SQL that has a list of Storedprocedures: Sprocs Table: SPID - PK (int), ID (int), NAME (string), TYPE (string)
The ID is a Foreign key (corresponding to a Company ID), the name is the stored procedure name, and Type (is the type of SP).

On my application I need to a certain SP depending on the company selected and what page you are on. I have a seperate SP that passes in parameters for both Company, and Type and should output the Name value:

ALTERPROCEDURE [dbo].[S_SPROC]
(@.IDint,@.TYPECHAR(10),@.NAMECHAR(20) OUTPUT)
AS

SELECT @.NAME= NAME
FROM SPROCS
WHERE [ID]= @.ID
AND [TYPE]= @.TYPE

Unfortunately I dont seem to be able to get the output in .Net, or then be able to fill my dataset with the Stored Procedure.
Has anyone done something similar before, or could point me in the right direction to solving this problem.

Thanks
Phil

Since @.NAME is an output parameter, you need to indicate that in your Command object (ParameterDirection.InputOutput or ParameterDirection.Output). That allows the parameter's value to be retrieved after the command has been executed.

Alternatively, you could select the data like you would in a normal data retrieval, and not worry about using an output parameter.

|||

Thanks for your reply Mark, I will try adding the ParameterDirection part.

If I use normal data retrieval how can I select the appropriate stored procedure when I try filling my table adapter from the dataset?

Thanks

|||

I assumed you would be performing an operation to select the stored proc name, then another operation to execute that stored proc.

|||

Yes that is what I am trying to do, but not so sure on how to go about it. Do you have any code examples?

Thanks

|||

hi mate,

Here is a sample

Dim cmd_ObjectpathAsNew SqlCommand("Select * from [" & tabelName &"]", sqlCon)

Dim adapterAsNew SqlDataAdapter(cmd_Objectpath)

Dim resultAsNew DataTable

adapter.Fill(result)

ForEach rowAs DataRowIn result.Rows

////do the process u want

next

Smile

|||

The code I have so far is:

Dim IDAs Int32
Dim TypeAsString

PrivateSub SimpleButton1_Click(ByVal senderAs System.Object,ByVal eAs System.EventArgs)Handles SimpleButton1.Click

ID =Me.TextBox1.Text
Type =Me.TextBox2.Text

Me.SPROCSTableAdapter.Fill(Me.DataSet1.SPROCS, ID, Type)

GetSprocName("AUMS_VALID")

Try

'Logic is a seperate VB file containing further code
Logic.run_SQL_fill_dataset(Me.sqlDataAdapter1, DataSet1.GEN_VALID)
Catch exAs Exception

EndTry

EndSub

PrivateFunction GetSprocName(ByVal st1)AsString
' Gets the names for the sprocs so each table can be filled with differant data. Using value 1 for param 1 just to test
Me.SQLCommand_GetSprocName.Parameters(1).Value = 1
Me.SQLCommand_GetSprocName.Parameters(2).Value = st1.ToString()
Logic.run_SQL_command(Me.sqlConnection1,Me.SQLCommand_GetSprocName)
' This is is where the app seems to fail
ReturnMe.SQLCommand_GetSprocName.Parameters(3).Value.ToString()

EndFunction

**** Code in Logic File: *****

'Sub to run SQLcommand, checks the connection and haddles errors

PublicSharedSub run_SQL_command(ByVal sqlcon1As SqlClient.SqlConnection,ByVal sqlcom1As SqlClient.SqlCommand)

Try
If sqlcon1.State <> ConnectionState.ClosedThen' connection check
sqlcon1.Close()
EndIf

If sqlcon1.State = ConnectionState.ClosedThen' connection check

sqlcon1.Open()

EndIf

sqlcom1.ExecuteNonQuery()

If sqlcon1.State = ConnectionState.OpenThen

sqlcon1.Close()

EndIf

Catch exAs Exception

If sqlcon1.State = ConnectionState.OpenThen

sqlcon1.Close()

EndIf

Error_box(ex,"Error on Running SQL Command")'Can place more better code here later

MsgBox(sqlcom1.CommandText.ToString)

EndTry

EndSub

PublicSharedSub run_SQL_fill_dataset(ByVal sqladapterAs SqlClient.SqlDataAdapter,ByVal datatableAs Data.DataTable)

Try

datatable.Clear()

sqladapter.Fill(datatable)

Catch exAs Exception

Error_box(ex,"Error on fill on dataset.")

EndTry

|||

Hi,


I'm afraid that there's something wrong in your code. What we can provide is a general process of communicating with a stored procedure from a .NET application.

Let's take the stored procedure you provided as the sample.

ALTER PROCEDURE [dbo].[S_SPROC]
( @.ID int, @.TYPE CHAR(10), @.NAME CHAR(20) OUTPUT )
AS

SELECT @.NAME = NAME
FROM SPROCS
WHERE [ID] = @.ID
AND [TYPE] = @.TYPE

In your procs, there are 2 input parameters and an output parameter. Then in your application, you should following the steps below:

1. Create the connection which links to the database.
a) Dim myconn As New SqlConnection(ConnectionString)

2. Create the SqlCommand object which execute the procs.
Dim sc As New SqlCommand()
sc.CommandType = CommandType.StoredProcedure
sc.CommandText = "YourProcsName"
sc.Connection = myconn

3. Setting your parameters and add them to SqlCommand object.

Dim sp1 As New SqlParameter()
sp1.ParameterName = "Parameter1"
sp1.Value = ""

Dim sp2 As New SqlParameter()
sp2.ParameterName = "Parameter2"
sp2.Value = ""

Dim sp3 As New SqlParameter()
sp3.ParameterName = "Parameter3"
sp3.Size = 10
sp3.Direction = ParameterDirection.Output

sc.Parameters.Add(sp1)
sc.Parameters.Add(sp2)
sc.Parameters.Add(sp3)

4. Open the connection, execute the process, and get the output parameter.

myconn.Open()
sc.ExecuteNonQuery()
myconn.Close()
Dim c As String = sp.Value.ToString()


After all, you can get the output parameter from the variable C.

Besides, this is a WebForm support forum, if you are developing WindowForm application, it would be better for you to go to MSDN forum where you can get more help.

Thanks.

|||

Thanks for your reply - it has been a big help.

Phil

Problems calling ::fn_helpcollations() on MS SQL 7.0

Hi.
I have som date/time inconsistency between a MS SQL 7.0 srv. database which
I built up on a MS SQL 2000 srv. database. I was told to use the SELECT *
FROM ::fn_helpcollations() to find out the settings on my (old) 7.0
database, but it fails (incorrect syntax near ':'.). What's the correct
syntax on MS SQL 7.0?
Regards
Mr. SmithHi
There is no correct syntax for SQL Server 7.0 and Functions as Functions are
not supported in SQL Server 7.0.
Regards
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"Mr. Smith" <nospam@.blindfolded.gone> wrote in message
news:Olby%23$CxFHA.1032@.TK2MSFTNGP12.phx.gbl...
> Hi.
> I have som date/time inconsistency between a MS SQL 7.0 srv. database
> which I built up on a MS SQL 2000 srv. database. I was told to use the
> SELECT * FROM ::fn_helpcollations() to find out the settings on my (old)
> 7.0 database, but it fails (incorrect syntax near ':'.). What's the
> correct syntax on MS SQL 7.0?
> Regards
> Mr. Smith
>

Tuesday, March 20, 2012

Problems calling ::fn_helpcollations() on MS SQL 7.0

Hi.
I have som date/time inconsistency between a MS SQL 7.0 srv. database which
I built up on a MS SQL 2000 srv. database. I was told to use the SELECT *
FROM ::fn_helpcollations() to find out the settings on my (old) 7.0
database, but it fails (incorrect syntax near ':'.). What's the correct
syntax on MS SQL 7.0?
Regards
Mr. SmithHi
There is no correct syntax for SQL Server 7.0 and Functions as Functions are
not supported in SQL Server 7.0.
Regards
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"Mr. Smith" <nospam@.blindfolded.gone> wrote in message
news:Olby%23$CxFHA.1032@.TK2MSFTNGP12.phx.gbl...
> Hi.
> I have som date/time inconsistency between a MS SQL 7.0 srv. database
> which I built up on a MS SQL 2000 srv. database. I was told to use the
> SELECT * FROM ::fn_helpcollations() to find out the settings on my (old)
> 7.0 database, but it fails (incorrect syntax near ':'.). What's the
> correct syntax on MS SQL 7.0?
> Regards
> Mr. Smith
>

Problems calling ::fn_helpcollations() on MS SQL 7.0

Hi.
I have som date/time inconsistency between a MS SQL 7.0 srv. database which
I built up on a MS SQL 2000 srv. database. I was told to use the SELECT *
FROM ::fn_helpcollations() to find out the settings on my (old) 7.0
database, but it fails (incorrect syntax near ':'.). What's the correct
syntax on MS SQL 7.0?
Regards
Mr. Smith
Hi
There is no correct syntax for SQL Server 7.0 and Functions as Functions are
not supported in SQL Server 7.0.
Regards
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"Mr. Smith" <nospam@.blindfolded.gone> wrote in message
news:Olby%23$CxFHA.1032@.TK2MSFTNGP12.phx.gbl...
> Hi.
> I have som date/time inconsistency between a MS SQL 7.0 srv. database
> which I built up on a MS SQL 2000 srv. database. I was told to use the
> SELECT * FROM ::fn_helpcollations() to find out the settings on my (old)
> 7.0 database, but it fails (incorrect syntax near ':'.). What's the
> correct syntax on MS SQL 7.0?
> Regards
> Mr. Smith
>