Showing posts with label execute. Show all posts
Showing posts with label execute. Show all posts

Monday, March 19, 2012

ConnectionRead (InvalidParam()) error

I get the following error sometimes when I execute a store procedure from SQ
L
Query Analyzer. After a few more attempts, the query succeeds... How can I
troubleshoot this network error...
[Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionRead (Inv
alidParam()).
Server: Msg 11, Level 16, State 1, Line 0
General network error. Check your network documentation.
Connection BrokeFirst thing to check, just like the message stated, "General network error.
Check your network documentation." The fact that it sometimes works and
sometimes not points to an unstable network.
hth
Quentin
"Shaila" <Shailaja @.discussions.microsoft.com> wrote in message
news:03329249-66CC-4806-91A9-D5434C3130D9@.microsoft.com...
>I get the following error sometimes when I execute a store procedure from
>SQL
> Query Analyzer. After a few more attempts, the query succeeds... How can I
> troubleshoot this network error...
> [Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionRead
> (InvalidParam()).
> Server: Msg 11, Level 16, State 1, Line 0
> General network error. Check your network documentation.
> Connection Broke

ConnectionRead (InvalidParam()) error

I get the following error sometimes when I execute a store procedure from SQL
Query Analyzer. After a few more attempts, the query succeeds... How can I
troubleshoot this network error...
[Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionRead (InvalidParam()).
Server: Msg 11, Level 16, State 1, Line 0
General network error. Check your network documentation.
Connection BrokeFirst thing to check, just like the message stated, "General network error.
Check your network documentation." The fact that it sometimes works and
sometimes not points to an unstable network.
hth
Quentin
"Shaila" <Shailaja @.discussions.microsoft.com> wrote in message
news:03329249-66CC-4806-91A9-D5434C3130D9@.microsoft.com...
>I get the following error sometimes when I execute a store procedure from
>SQL
> Query Analyzer. After a few more attempts, the query succeeds... How can I
> troubleshoot this network error...
> [Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionRead
> (InvalidParam()).
> Server: Msg 11, Level 16, State 1, Line 0
> General network error. Check your network documentation.
> Connection Broke

ConnectionRead (InvalidParam()) error

I get the following error sometimes when I execute a store procedure from SQL
Query Analyzer. After a few more attempts, the query succeeds... How can I
troubleshoot this network error...
[Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionRead (InvalidParam()).
Server: Msg 11, Level 16, State 1, Line 0
General network error. Check your network documentation.
Connection Broke
First thing to check, just like the message stated, "General network error.
Check your network documentation." The fact that it sometimes works and
sometimes not points to an unstable network.
hth
Quentin
"Shaila" <Shailaja @.discussions.microsoft.com> wrote in message
news:03329249-66CC-4806-91A9-D5434C3130D9@.microsoft.com...
>I get the following error sometimes when I execute a store procedure from
>SQL
> Query Analyzer. After a few more attempts, the query succeeds... How can I
> troubleshoot this network error...
> [Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionRead
> (InvalidParam()).
> Server: Msg 11, Level 16, State 1, Line 0
> General network error. Check your network documentation.
> Connection Broke

Sunday, March 11, 2012

Connection to Sql-Server

Hi,

I'm a newbie at the asp.net site.
The things i have done where with access.
But now i want to use Sql-server

In access i used this to execute a query:

*** In the global.asax ***
session("dbpath") = "Provider=Microsoft.Jet.OLEDB.4.0; Ole DB Services=-4; Data Source=" + Server.MapPath("\db\MediaProject.mdb")

*** Return dataSet ***
ResultDS = GetSql(SqlStatement, session("dbpath"))
Dim ResultDS AS system.data.dataset

*** Lib file: ***
Function GetSQL(a As string, b as string) As System.Data.DataSet
Dim connectionString As String = b
Dim dbConnection As System.Data.IDbConnection = New System.Data.OleDb.OleDbConnection(connectionString)
Dim queryString As String = a
Dim dbCommand As System.Data.IDbCommand = New System.Data.OleDb.OleDbCommand
dbCommand.CommandText = queryString
dbCommand.Connection = dbConnection

Dim dataAdapter As System.Data.IDbDataAdapter = New System.Data.OleDb.OleDbDataAdapter
dataAdapter.SelectCommand = dbCommand
Dim dataSet As System.Data.DataSet = New System.Data.DataSet
dataAdapter.Fill(dataSet)

The question now is wich string do i now have to put in the session("dbpath") ?
Which is the Provider?
How does the string looks like.
Or do i use something else now ?

Many thanx in advance


oSQLConn.ConnectionString = "Data Source=xxx.xxx.xxx.xxx,1433;" & _
"Initial Catalog=mySQLServerDBName;" & _
"User ID=myUsername;" & _
"Password=myPassword"

Thursday, March 8, 2012

connection to right dB in server SQL server 7.0

I have the following SP.
the problem is when the execute is performed it gets another DB with a
similar name.
physicianlaboratories_Interface.
I am leaning towards the name is to long. if so what is max length for a
unique name.
Alter Procedure ADP_CompleteXMLOrderImport
@.Storename varchar(50)
As
set nocount on
IF @.SToreName = 'physlabs'
BEGIN
EXECUTE physicianlaboratories_com..ADP_CompleteXMLOrderImp ort
RETURN 0
END
return
Hi,
The max length for Database name is 128 characters.
Just try the "[ ]"
Alter Procedure [ADP_CompleteXMLOrderImport]
@.Storename varchar(50)
As
set nocount on
IF @.SToreName = 'physlabs'
BEGIN
EXECUTE [physicianlaboratories_com]..[ADP_CompleteXMLOrderImport]
RETURN 0
END
return
HTH
Ashish
This posting is provided "AS IS" with no warranties, and confers no rights.
|||thanks, tried the [] did not do anything.
I believe there is also a maximum length for Unique DB names.
it also may be constraint of the ODBC driver.
"Ashish Ruparel [MSFT]" <v-ashrup@.online.microsoft.com> wrote in message
news:52j#sy8OEHA.3800@.cpmsftngxa10.phx.gbl...
> Hi,
> The max length for Database name is 128 characters.
> Just try the "[ ]"
> Alter Procedure [ADP_CompleteXMLOrderImport]
> @.Storename varchar(50)
> As
> set nocount on
> IF @.SToreName = 'physlabs'
> BEGIN
> EXECUTE [physicianlaboratories_com]..[ADP_CompleteXMLOrderImport]
> RETURN 0
> END
> return
>
> HTH
> Ashish
> This posting is provided "AS IS" with no warranties, and confers no
rights.
>

connection to right dB in server SQL server 7.0

I have the following SP.
the problem is when the execute is performed it gets another DB with a
similar name.
physicianlaboratories_Interface.
I am leaning towards the name is to long. if so what is max length for a
unique name.
Alter Procedure ADP_CompleteXMLOrderImport
@.Storename varchar(50)
As
set nocount on
IF @.SToreName = 'physlabs'
BEGIN
EXECUTE physicianlaboratories_com..ADP_CompleteXMLOrderImport
RETURN 0
END
returnHi,
The max length for Database name is 128 characters.
Just try the "[ ]"
Alter Procedure [ADP_CompleteXMLOrderImport]
@.Storename varchar(50)
As
set nocount on
IF @.SToreName = 'physlabs'
BEGIN
EXECUTE [physicianlaboratories_com]..[ADP_CompleteXMLOrderImport]
RETURN 0
END
return
HTH
Ashish
This posting is provided "AS IS" with no warranties, and confers no rights.|||thanks, tried the [] did not do anything.
I believe there is also a maximum length for Unique DB names.
it also may be constraint of the ODBC driver.
"Ashish Ruparel [MSFT]" <v-ashrup@.online.microsoft.com> wrote in message
news:52j#sy8OEHA.3800@.cpmsftngxa10.phx.gbl...
> Hi,
> The max length for Database name is 128 characters.
> Just try the "[ ]"
> Alter Procedure [ADP_CompleteXMLOrderImport]
> @.Storename varchar(50)
> As
> set nocount on
> IF @.SToreName = 'physlabs'
> BEGIN
> EXECUTE [physicianlaboratories_com]..[ADP_CompleteXMLOrderImport
]
> RETURN 0
> END
> return
>
> HTH
> Ashish
> This posting is provided "AS IS" with no warranties, and confers no
rights.
>

Wednesday, March 7, 2012

Connection TimeOut seems not working properly

Hi all,

I use SqlHelper to connect to database. I need to set a timeout to execute some sp because I don′t want to wait for this sp if it make me wait a lot. So I set the Connection TimeOut every time I execute a sp. But this seems not working properly. I set this value to 5 and I execute a sp than runs in 15 but It waits for it.

Any idea

Best regards

www.ITCubo.net

SqlCommands and SqlConnections both have timeout parameters. Maybe one of their values is interfering with what you want.

Friday, February 10, 2012

Connection Problem trying to execute stored procedure

I am running the following code and getting the error below:

Dim connectionstringAsString ="<%$ ConnectionStrings:ConnectionString %>"Dim ConnectionAsNew SqlClient.SqlConnection(connectionstring)Dim CommandAsNew SqlClient.SqlCommand("StoredProcedure9", Connection)

Command.CommandType = Data.CommandType.StoredProcedure

Command.Parameters.Add(

New SqlClient.SqlParameter("@.bid_id", Data.SqlDbType.Int))

Command.Parameters(

"@.bid_id").Value ="Testing"

Connection.Open()

Command.ExecuteNonQuery()

Connection.Close()

ERROR:

Format of the initialization string does not conform to specification starting at index 0.

I think my connectionstring is wrong, please help.

Thanks

CAB

Try changing:
Dim connectionstringAsString ="<%$ ConnectionStrings:ConnectionString %>"

To

Dim connectionstring as String = System.Configuration.ConnectionStrings("MyConnectionStringName").ConnectionString (or something similar to that...)

Which will grab the connectionstring out of your web.config and plug it in as the property in question. (I'm not too up on VB.NET 2.0 so I may be wrong - but pretty sure you can't use the <% %> (i.e. pre-processing tags) inside of compilable VB.NET code - i.e. I think that's your issue)
|||

Hi,

Thanks for your help, but now I am getting:

'ConnectionStrings' is not a member of 'Configuration'.

Any ideas?

|||Cabby, can you let us know which version of the .NET Framework you are using? 1.1 or 2.0?|||

Hi, I am using version 2.0

I have updated that line of code to

Dim connectionstringAsString = System.Configuration.ConfigurationManager.AppSettings("connectionstring")

and am now getting:

The ConnectionString property has not been initialized.

This seems to be a similar problem tohttp://forums.asp.net/thread/402876.aspx but I am not sure I understand what needs to be done.

Please help!

Thanks

CAB

|||That other link was for ASP.NET 1.1. See if this article helps:Configuration API Improvements in ASP.NET 2.0
|||

Thanks for the link. But that seems to be working fine. When I run:

<%

@.ImportNamespace="System.Configuration" %>

<%

@.ImportNamespace="System.Web.Configuration" %>

<

scriptrunat=serverlanguage=C#>publicvoidPage_Load(objectsource,EventArgse)

{

Response.Write("Connection String:"

+

ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);

}

</

script>

<

html>

<

head><title>Retrieving Connection Strings</title>

</

head>

<

body>

<

formid="form1"runat="server"><div></div>

</

form>

</

body>

</

html>

I get:

Connection String:Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Database.mdf;Integrated Security=True;User Instance=True

Which I assume means all is working with that page.

But when I run my code:

ProtectedSub DetailsView1_ItemInserted(ByVal senderAsObject,ByVal eAs System.Web.UI.WebControls.DetailsViewInsertedEventArgs)

Dim connectionstringAsString = System.Configuration.ConfigurationManager.AppSettings("ConnectionString")Dim ConnectionAsNew SqlClient.SqlConnection(connectionstring)Dim CommandAsNew SqlClient.SqlCommand("StoredProcedure9", Connection)

Command.CommandType = Data.CommandType.StoredProcedure

Command.Parameters.Add(

New SqlClient.SqlParameter("@.bid_id", Data.SqlDbType.Int))

Command.Parameters(

"@.bid_id").Value ="Testing"

Connection.Open()

Command.ExecuteNonQuery()

Connection.Close()

Response.Redirect(

"Default.aspx")EndSub

I get:

The ConnectionString property has not been initialized.

Any ideas?

Thanks

|||

UPDATE:

I have changed the connection string to:

Dim

connectionstringAsString = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString()This seems to be getting a bit further, now my error is:

Input string was not in a correct format.

which seems to be relating to the line:

Command.ExecuteNonQuery()

any ideas?

Thanks, CAB

|||

The problem is with my parameters, the stored procedure works fine if I dont try and pass it any parameters and remove :

Command.Parameters.Add(New SqlClient.SqlParameter("@.bid_id", Data.SqlDbType.Int))

I have realised that I can do this all in the stored procedure and not have to pass any variables so now all is working fine.

Thanks for all the help!!!!!

CABBY