CodeVerge.Net Beta


   Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums




Can Reply:  No Members Can Edit: No Online: Yes
Zone: > Asp.Net Forum > visual_studio.visual_studio_2005 Tags:
Item Type: Date Entered: 7/19/2007 10:00:39 AM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
NR
XPoints: N/A Replies: 4 Views: 139 Favorited: 0 Favorite
5 Items, 1 Pages 1 |< << Go >> >|
"c0rrupt" <>
NewsGroup User
SqlParameter collections7/19/2007 10:00:39 AM

0

 Dim parameters As New SqlParameterCollection()

            parameters(0) = New SqlParameter("board_id", board_id)

 

 

Why isn't this working? Does anyone know an alternative? I'm looking to byref a collection of sqlparameters to my data provider, and then extract output parameters from the referenced collection

"omerkamal" <>
NewsGroup User
Re: SqlParameter collections7/19/2007 11:49:14 AM

0

it can not be initialize with "New" keyword

 rather it is used with sqlCommand

   Dim myCommand As New SqlCommand
myCommand.Parameters.Add("@board_id", Data.SqlDbType.Int).Value = board_id

 
 
 Click to visit
We help with .NET Development. Visit us and share your part!
"c0rrupt" <>
NewsGroup User
Re: SqlParameter collections7/19/2007 12:44:43 PM

0

 
Shared Function ExecuteStoredProcedureQuery(ByVal procedurename As String, Optional ByRef inputparamters As SqlParameterCollection = Nothing) As DataTable
'Code that declared sqlcommand, and performs the query...
End Function
 

 Would it be efficient to send in a SqlCommand with a collection of parameters? How about using the Collections class?

"c0rrupt" <>
NewsGroup User
Re: SqlParameter collections7/19/2007 12:50:59 PM

0

 How about passing in SqlParameter()?

"omerkamal" <>
NewsGroup User
Re: SqlParameter collections7/19/2007 4:28:38 PM

0

as i said SqlParameterCollection is not ment to initialise. It is a helping Class for the Command and Parameters objects.

if you wan to create a collection then you can create an array Collection of the Parameters.

here is just a small example:

 

 Public Sub AddSqlParameter(ByVal cmd As System.Data.SqlClient.SqlCommand, _
           ByVal params As System.Collections.ArrayList)

        Dim parser As System.Collections.IEnumerator
        parser = params.GetEnumerator()

        While parser.MoveNext()
            cmd.Parameters.Add(parser.Current)
        End While

    End Sub

  Now, we can pass the Parameters like this:

        Dim ar As New ArrayList
        Dim sqlprm1 As New SqlParameter
        Dim sqlprm2 As New SqlParameter
        Dim sqlprm2 As New SqlParameter

        sqlprm1.Value = field1
        sqlprm2.Value = field2
        sqlprm3.Value = field3

        ar.Add(sqlprm1)
        ar.Add(sqlprm2)
        ar.Add(sqlprm3)

        Dim myCommand As New SqlCommand
        AddSqlParameter(myCommand, ar)
 
 Click to visit
We help with .NET Development. Visit us and share your part!
5 Items, 1 Pages 1 |< << Go >> >|


Free Download:













moving a dataset file .xsd from web site to a class library causes error

toolboxitem fail to drag and drop

where used

rename splitter container, panels lost and everything in them!

databinding property for textbox control

bug in w3wp.exe (version: 6.0.3790.3959), in windows server 2003 sp2

vs2005 and active directory

xml documentation for a vs2005 web site or web services site

scanning in .net 1.1 application

error msb6006: "aspnet_compiler.exe" exited with code 1

web server

vss2005 over the internet (disk full error for non- administrator user)

re:public ip address

app_code folder configuration

debuging in vs2005 beta2

how is asp.net development server different from regular iis server on windows xp pro?

strange debugging behavior - skipping lines of code

smart tags won't open and some intellisense won't fully work after installing linq ctp

must be a way to exclude web project bin folder from vss checkin, please!

no list at class property of html element when a css is linked

design view is locked in visual studio 2005

are they going occur problem to install .net both 2003 & 2005 in one pc and one windows ????

error aspruntime: object reference not set to an instance of an object

best method of changing the connection string at runtime?

code snippets by project/solution

datatable export to excel

can i create 1.1 projects in vs 2005

turning off missing image errors?

how can i import record from csv file to mysql database in the fastest way through asp.net 2.0

system.componentmodel.component in vs 2005

setting default document on the development server

error extending system.web.ui.page arrgghhh help please ;)

miss items in tool box

storing a piece of code in the toolbox

vs 2005 grid lines or ruler for design view ?

dataset : expression column doesn't work?

creating submit buttons in asp.net 2.0

failed to install msxml 6.0 parser during installation of visual studio

controlling what "nest related files" does

debugging in vista

switching from dev web server to local iis?

vb6 vs vb2005 on ide navigation (integrated design environment navigation)

tables in design view

visual studio 2005 vs visual web developer

adding a projects reference in vs.net 2005

gridview delete by role?

visual studio 2005 - avp.exe appears in solution explorer

connection to sql express from vs2005

can't i view/edit files in hex/binary mode in vs2005?

editplus opens when visual studio 2005 starts asp.net development server

   
  Privacy | Contact Us
All Times Are GMT