For more information, please refer to the following link:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/
frlrfSystemDataSqlClientSqlParameterClassctorTopic6.asp
Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
--------------------
| Newsgroups: microsoft.public.dotnet.languages.vb
| From: (e-mail address removed) (Kevin Yu [MSFT])
| Organization: Microsoft
| Date: Fri, 14 Nov 2003 06:33:30 GMT
| Subject: RE: Shortest code footprint for .Parameter.Add?
| X-Tomcat-NG: microsoft.public.dotnet.languages.vb
| MIME-Version: 1.0
| Content-Type: text/plain
| Content-Transfer-Encoding: 7bit
|
| Hi Dean,
|
| You can use the following overload to create the parameter to add the
| parameter to the SqlCommand.
|
| SqlParameter p = SqlCommand.Parameters.Add(new SqlParameter(String,
| SqlDbType, Int32, ParameterDirection, Boolean, Byte, Byte, String,
| DataRowVersion, Object));
|
| p.Value = chrLetter;
|
| However, the value has to be set sepeartely.
|
| HTH. If anything is unclear, please feel free to reply to the post.
|
| Kevin Yu
| =======
| "This posting is provided "AS IS" with no warranties, and confers no
| rights."
|
| --------------------
| | From: "Dean Slindee" <
[email protected]>
| | Subject: Shortest code footprint for .Parameter.Add?
| | Date: Thu, 13 Nov 2003 12:42:59 -0600
| | Lines: 39
| | X-Priority: 3
| | X-MSMail-Priority: Normal
| | X-Newsreader: Microsoft Outlook Express 6.00.3790.0
| | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| | Message-ID: <
[email protected]>
| | Newsgroups: microsoft.public.dotnet.languages.vb
| | NNTP-Posting-Host: 0-1pool36-7.nas14.milwaukee1.wi.us.da.qwest.net
| 63.156.36.7
| | Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
| | Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.vb:156600
| | X-Tomcat-NG: microsoft.public.dotnet.languages.vb
| |
| | Is there a way to replace the commented out parameter add syntax with a
| | single line of code, like the .Parameter.Add("@Letter"...) line below
| (which
| | does not work)?
| |
| | 'Dim prmLetter As New SqlParameter
| |
| | 'With prmLetter
| |
| | ' .ParameterName = "@Letter"
| |
| | ' .SqlDbType = SqlDbType.Char
| |
| | ' .Direction = ParameterDirection.Input
| |
| | ' .Value = chrLetter
| |
| | 'End With
| |
| |
| |
| | With cmd
| |
| | .CommandType = CommandType.StoredProcedure
| |
| | .CommandText = "GetMasterIndexRowsWithLetter"
| |
| | .Parameters.Add("@Letter", SqlDbType.Char, 1,
chrLetter)
| |
| | '.Parameters.Add(prmLetter)
| |
| | End With
| |
| |
| |
| | Thanks,
| |
| | Dean Slindee
| |
| |
| |
|