Data Access Application Block: Using In Class Library
Nov 16, 2007
I'm trying to use the Data Access Application block, and am having some issues with configuration. I am using it in a class library, and it seems that with v 3 you need to configure the DAAB first, making changes to the configuration file. However, in a class library, I do not seem to have the web.config or app.config file to change. So where do I need to store the configuration settings?
Thanks,
Paul
View 3 Replies
ADVERTISEMENT
Apr 22, 2008
This is my code...
public partial class test : System.Web.UI.Page
{protected void Page_Load(object sender, EventArgs e)
{SqlDatabase database = (SqlDatabase)DatabaseFactory.CreateDatabase("ConnectionString");DbCommand command = database.GetSqlStringCommand("SELECT UserName FROM Users WHERE UserID = '6264'");
using (IDataReader reader = database.ExecuteReader(command))
{if (reader.Read())
{lblTest.Text = "test";
}
}
}
}
This is my error:
Server Error in '/' Application.
Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.InvalidOperationException: Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.Source Error:
Line 21: //DbCommand command = database.GetStoredProcCommand("CorrUsers_GetByUserId_s");
Line 22: DbCommand command = database.GetSqlStringCommand("SELECT UserName FROM Users WHERE UserID = '6264'");
Line 23: database.ExecuteReader(command);
Line 24: using (IDataReader reader = database.ExecuteReader(command))
Line 25: {Source File: d:webwwwrootchacha078dev.cha.toplingo.com est.aspx.cs Line: 23 Stack Trace:
[InvalidOperationException: Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.]
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +1261381
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +105
System.Data.SqlClient.SqlConnection.Open() +111
Microsoft.Practices.EnterpriseLibrary.Data.Database.GetNewOpenConnection() +195
Microsoft.Practices.EnterpriseLibrary.Data.Database.GetOpenConnection(Boolean disposeInnerConnection) +106
Microsoft.Practices.EnterpriseLibrary.Data.Database.ExecuteReader(DbCommand command) +62
test.Page_Load(Object sender, EventArgs e) in d:webwwwrootchacha078dev.cha.toplingo.com est.aspx.cs:23
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +33
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1436
Any help with this matter would be very much appreciated.
Thank you for your time.
Sincerely,
Jeffrey Pham
View 3 Replies
View Related
Jan 16, 2008
We are expanding an application's database hardware to have a mirrored failover server. Normally in this case we just have the application add "Failover Partner=MirredServerName" in the connection string.
However, this application is using the Enterprise Library Data Access Block and we can't find any documentation describing how to setup the Failover Partner using this library. Any help would be appreciated.
JOHNF
View 3 Replies
View Related
Nov 10, 2005
Hi,
Is there anyway I can impliment this in my application without installing it as a COM. My Web Hoster says they won't install it. The Data Access Application Block
View 3 Replies
View Related
May 1, 2008
Does anybody knows, from where can I download the latest version of DAAB for SQL CE 3.5?
I know that the Moblie Client Softvare Factory was included a DAAB, but it is outdated in some respect.
So any information will be greatly appreciated.
Gabor
View 3 Replies
View Related
Jul 12, 2006
I download the DAAB CF version. However, most of them use SQLCEClient to connect to the database. Is there any DAAB that use SQLClient?
One workaround that I made is I replaced all SQLCEClient objects with the SQLClient objects. I only test one method "ExecuteDataset" and it works so far. However, my question is "does my workaround a good solution?"
Thanks,
Hendra
View 1 Replies
View Related
Oct 18, 2007
Hi,
I´m wondering if is it possible to use the SSIS Class Library without SQLServer installed in the machine or if is it necessary to install SLQ Server in order to use SSIS objects?
thaks.
View 4 Replies
View Related
Oct 17, 2006
Hi All,
Now I am creating .Net CF2.0 class library project, and I have some public method which take parameters. And I commented those method using following tag.
/// <summary>
///
/// </summary>
/// <returns></returns>
But when I add to other project where I wanted use that dll , when I create instance and call the method it€™s not giving me the description which I gave. But when I refer in the same class library project itself it€™s giving outside that it€™s not giving the details.
Could you please anyone to solve this problem ??
Thanks ,
Jayakumar a
View 1 Replies
View Related
Jan 8, 2008
Hi There!I have a big application which has two parts. A back-end developed in Deplhi 7 for desktop and a front-end developed in ASP.net C#. The problem I am facing is to integrate the login between both applications. I have a database that has the USER table with the PASSWORD encrypted and I've been already developed a Class Library with all the needs of Cryptography that has been used by the ASP.net application to authenticate users. The thing is, the desktop application has to authenticate the users too with the very same cryptography method, but Dephi cannot use dotNet assemblies (?). The client of the application ask to not use a web service and I'm trying to do this cryptography on the data base.The question is: Is there any way to invoke a dotNet Class Library through a SQL Server 2000 Stored Procedure?Consider that the Dephi developers had researched some ways to use dotNet assembly inside their application with no success. They had tried to develop their own cryptography method based on the algorithm that I had said them, but the encrypted string is different. Whenever the application try to match the strings, it doesn't work.Do you have some idea guys?Thanks in Advance! Ramon Silva
View 1 Replies
View Related
Aug 15, 2006
Good Morning..
We're having a heck of a good time trying to implement our first CDE project in SSRS 2005.
In our SDE class library we have included an App.Config file where we want to store configuration settings..
Trouble is that when we view the configuration settings or connection string settings in debug mode, they're not being read for some reason..
Here's our app.config file:
-------------------------------------------------------------
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
</configSections>
<appSettings>
<add key="eventLogName" value="FocusDPEEventLog" />
</appSettings>
<connectionStrings>
<add name="PassConnString" connectionString="Data Source=SOMEDATASOURSE;Persist Security Info=True;User ID=SOMEUSERNAME;Password=SOMEPASSWORD;Unicode=True"
providerName="System.Data.OracleClient" />
</connectionStrings>
</configuration>
-------------------------------------------------------------
Here's what our Immediate window Debugger is tellin' us about our configuration settings:
-------------------------------------------------------------
ConfigurationManager.AppSettings
{System.Configuration.KeyValueInternalCollection}
[System.Configuration.KeyValueInternalCollection]: {System.Configuration.KeyValueInternalCollection}
base {System.Collections.Specialized.NameObjectCollectionBase}: {System.Configuration.KeyValueInternalCollection}
AllKeys: {Dimensions:[0]}<----incorrect should be 1
ConfigurationManager.ConnectionStrings
Count = 1 <----ok, is one, but the wrong 1, see 3 lines down...
base {System.Configuration.ConfigurationElementCollection}: Count = 1
ConfigurationManager.ConnectionStrings[0]
{data source=.SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true}<--Should be PassConnString
base {System.Configuration.ConfigurationElement}: {data source=.SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true}
ConnectionString: "data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true"
Name: "LocalSqlServer"
ProviderName: "System.Data.SqlClient"
Now notice the stuff in bold...I have NO IDEA where this gosh-danged thing is reading, but it doesn't seem like it's the app.config file in our class library...
thanks..
Doug
View 1 Replies
View Related
Dec 27, 2007
Good day everyone,
I have a package that loads data from a flat file, performs some transformations and then inserts the final data into a DB destination. The keys for the different DB records are generated in Script components in the Data Flow Tasks.
My question is concerning the Key Generation and I'll try to explain it on a simple example.
Package Structure:
The Control Flow contains two Data Flow tasks.
Each of the Data Flow Tasks contains a Script Component responsible for generating the keys of the records to be loaded during this data flow.
The code of the Script component is the following:
Code Block
Imports System
Imports System.Data
Imports System.Math
Imports Microsoft.SqlServer.Dts.Pipeline.Wrapper
Imports Microsoft.SqlServer.Dts.Runtime.Wrapper
Public Class KeyGenerator
' Field Definitions '
Private seed1 As Integer
Private seed2 As Integer
' Constructor '
Public Sub New(ByVal dbSeed1 As Integer, ByVal dbSeed2 As Integer)
.....
End Sub
' Generates the keys according to the seeds retrieved from the DB '
Public Function getNextKey() As Int64
...
...
Return generatedKey
End Function
End Class
Public Class ScriptMain
Inherits UserComponent
Private generator As New KeyGenerator(7, 5)
Public Overrides Sub Input0_ProcessInputRow(ByVal Row As Input0Buffer)
....
Row.NewKey = generator.getNextKey()
End Sub
End Class
Questions:
As you can see the KeyGenerator class code gets duplicated in each Script Component, which is definitely a bad practise. What I wish to do is to create the KeyGenerator class and deploy it as a library "somewhere". Then, in each Script Component, I should only import the KeyGenerator class.
1. Is that possible?
2. If yes, how can I do this?
3. If not, what is a best practise you would recommend which allows me to avoid this code duplication of the KeyGenerator class?
Thanks in adavance,
Samar
View 4 Replies
View Related
Jun 11, 2015
I have a requirement in which i have to create a custom .net class library for Ex:-I retrieve password(s) from a thrid party component. Below is what i am doing.
(1) Created a custom class library which reads a custom .xml file from a drive Ex:- "D:MyAppMYAppCofig.xml" and sets to my properties of my custom class library and inside it i created an instance of third party component's class and passed these values. Since i need to use this .net custom class library both in web and ssis/database side i am using this custom .xml file.
(2) After validating passed data (properties set in custom .net class library) the thrid party component instance object created in my custom .net class libraty returs a password to me own custom .net class libray.
(3) This password I use in my web app for connecting to database. This code is working fine.
(4) My question is how to execute a custom .net class library code through ssis and to use the my same custom .net class library and pass the password to my SSIS component / taks so that that code block also uses the returned password to connect and do any needed tasks? In other words how to use custom .net class library from SSIS.
My Environment is as follows:-
SQL Server is : 2008 R2
VS.NET 2013
View 5 Replies
View Related
Sep 6, 2006
Hello ...
Using Ent. Library Jan. 2006 release and .Net Framework 2.0, I'm connecting to SQL Server 2000 using Microsoft.Practices.EnterpriseLibrary.Data.Sql.
I have a windows service that processes jobs asynchronously and from time to time, I'm getting the following error --
"A connection was successfully established with the server, but then an error occurred during the pre-login handshake. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (TCP Provider error: 0 - An existing connection was forcibly closed by the remote host. "
What's surprising is the error message saying SQL Server 2005. Has anyone encountered and resolved this?
Thanks.
allanroy
View 6 Replies
View Related
Oct 30, 2015
I am trying to execute oracle procedure (anonymous block) with input and output parameters from ms sql code and return 2 values back:a number and a string.I am using **EXEC() AT** to execute oracle code and return a string back to ms sql. It works fine when returning numbers, but if I add a string output parameter, I am receiving an error:Msg 0, Level 11, State 0, Line 0...A severe error occurred on the current command.  The results, if any, should be discarded.
The server log has the following entry in exception.txt:
Exception 0xc0000005 EXCEPTION_ACCESS_VIOLATION reading address 00000005031C07E0 at 0x0000000070F9C183
There is also a SQLDump file generated:
* BEGIN STACK DUMP:
* Â 10/28/15 12:45:38 spid 63
* Â Exception Address = 000000005040C183 Module(MSVCR100+000000000003C183)
[code]....
It looks like the problem is in passing varchar2 from oracle into ms sql. I had logging code in oracle block, and it works fine. I have found a few examples of using **exec() at** but there is always only integer output passed back.
View 3 Replies
View Related
Mar 10, 2007
I am trying to find a solution to my woes creating CLR activation stored procedure that references Enterprise library data access dlls. Does anyone know best practices to deploy .NET 2.0 assemblies as SQLCLR. I am using VS2005 SqlClrProject to deploy my .NET 2.0 assemblies to Sql Server and it fails with error such as "Assembly was not found in the sql catalog". If I manually try to load a referenced assembly within SqlServer by browsing to the target location, like for example, System.Management.dll it fails with similar error, trying to resolve its dependencies. Even if I manage to walk through the dependency tree and resolve it to the final dependent dll, I am only able to load it in "UNSAFE" mode. Any recommendations, suggestions and feedback are welcome.
Thanks in advance.
View 4 Replies
View Related
Jan 22, 2008
I am creating an application that acts as a catalog for all the reference books available in our IT Department.
I've created the default page which has search capability, a details page in which you can click on a title and then view a description of the book.
Now I need to create the Check-Out button which will allow the user to "check out" the book for use. This will reduce the inventory of the book in the SQL database by 1, and store the check-out user and date in a SQL table that I've already created, called records. There will also be a Check-In button that will allow the user to check the book back in once they've returned it.
This is my first time updating data from an application, any reference recommendations to get me started?
View 1 Replies
View Related
Oct 30, 2006
I am building a web app using VS2005 and SQL 2005 I would like to use the Caching Application Block to cache objects from my BLL. I was wondering if there is a way of utilizing the build in SQLDependency in SQL 2005 with the Caching Application Block??? Does anybody have tried this, are there any samples on the web???
Thanks,
Newbie
View 1 Replies
View Related
Apr 20, 2007
I am using the 3-tiered architecture design (presentation, business laws, and data acess layers). I am stuck on how to send the image the user selects in the upload file control to the BLL and then to the DAL because the DAL does all the inserts into the database. I would like to be able to check the file type in the BLL to make sure the file being uploaded is indeed a picture. Is there a way I can send the location of the file to the BLL, check the filetype, then upload the file and have the DAL insert the image into the database? I have seen examples where people use streams to upload the file directly from their presentation layer, but I would like to keep everything seperated in the three classes if possible. I also wasn't sure what variable type the image would be in the function in the BLL that receive the image from the PL. If there are any examples or tips anyone can give me that would be appreciated.
View 2 Replies
View Related
Nov 20, 2007
I successfully upsized an Access database to SQL Server Express so that I have an Access frontend and a SQL Server Express backend. People started using this on an intranet, but right away they started complaining that sometimes their data wasn't saved. For example, they might have entered 8 records but when they went back to look at them only 4 were actually saved in the database. Any idea why this might be, or how I could trace the errors and find out?
Paul_in_Brunei
View 1 Replies
View Related
Jun 9, 2015
When i wanna run Application in other computers in network. The following error occurs.
error : System.Data.SqlClient.SqlException: Login failed for user 'Suren-PCGuest'.ConnectionStr = "Data Source=SUREN-PCMSSQLSERVER,1433;Initial Catalog=WorkFlow;Integrated Security=True";
View 5 Replies
View Related
May 3, 2007
How can I access data to SQL server 2005 using Windows form application,ADO.net and .Net remoting?
Can anybody help me? please...
View 5 Replies
View Related
Nov 17, 2007
Here is my situation: I am creating a database driven ASP.Net web application that will be used over the internet. My ASP.Net application connects to my SQL server 2005 database/server by using a SQL server login. I am using the DPAPI API to encrypt my connection stings with a hidden entropy value for extra security. I am using the SQL login for obvious reasons, as my users will not have a windows login.
What I am trying to do: I want to limit this SQL login account to be able to just run/execute stored procedures and NOT access the tables or views directly. In my ASP.Net application I am using the MS applications data block, and I am using stored procedures for every single database access action. There is no inline SQL being executed from my web application.
What I have tried so far:
I created a new schema and made the above SQL login account owner of this schema. I then granted "Execute" permissions to the SQL login and DENY permissions to all other permissions.
I created an database role with "Execute" only permissions and DENY permissions to all other permissions.
What Happened: In BOTH of the above scenarios I tested a direct SQL statement against one of my tables, from my ASP.Net application and I was able retrieve data back, NOT GOOD, exactly what I am trying to STOP.
If someone could give me (Step-by-Step) guide on how to setup the situation I am looking for, I would be very grateful!
Thanks to all that help!
View 13 Replies
View Related
Jul 31, 2015
I get the below error on the event log of my application server which uses SQL database.
Details: RuleId:a811dcbc-4c5b-d9de-592b-f01e17fc0e9a. HealthServiceId:a5f70248-b545-4d35-7c84-e7aa87610ee4. The INSERT statement conflicted with the FOREIGN KEY constraint "FK_Alert_BaseManagedEntity". The conflict occurred in database "OperationsManager",
table "dbo.BaseManagedEntity", column 'BaseManagedEntityId'.
The statement has been terminated.RuleId:a811dcbc-4c5b-d9de-592b-f01e17fc0e9a. HealthServiceId:a5f70248-b545-4d35-7c84-e7aa87610ee4. The INSERT statement conflicted with the FOREIGN KEY constraint "FK_Alert_BaseManagedEntity". The conflict occurred in database "OperationsManager", table "dbo.BaseManagedEntity", column 'BaseManagedEntityId'.The statement has been terminated..
Details: RuleId:a811dcbc-4c5b-d9de-592b-f01e17fc0e9a. HealthServiceId:a5f70248-b545-4d35-7c84-e7aa87610ee4. The INSERT statement conflicted with the FOREIGN KEY constraint "FK_Alert_BaseManagedEntity". The conflict occurred in database "OperationsManager", table "dbo. BaseManaged Entity", column 'BaseManagedEntityId'.The statement has been terminated..
View 5 Replies
View Related
Apr 8, 2008
Is possible block access to sql server database, from hostame (pc name). I know only the hostname and not the user.
Is possible?
Thanks
View 1 Replies
View Related
Feb 10, 2015
I need to run a script in production that adds primary key to a table. Because table is large, I can't run it in one shot, the log file is not so large to accommodate it. Instead, I created a new table with same structure plus new surrogate primary key, and I populate it in a cursor loop.
I already ran it many times in test server, and no problems with that. But the problem will be in production when applications will be accessing this table and try to insert/update it while I am running my loop.
So I am looking for a solution how to block users to access this table, it's OK if they receive an error. Setting database to single user mode will not work because I don't want to block them from all the rest tables in this database.
View 3 Replies
View Related
Dec 3, 2014
I have the following stored procedure to test scope of variables
alter proc updatePrereq
@pcntr int,
@pmax int
as
begin
[Code] ....
In the above script @i is declare in the if block only when the @pcntr value is 1. Assume the above stored procedure is called 5 times from this script
declare @z int
set @z = 1
declare @max int
set @max = 5
while @z <= @max
begin
exec dbo.updatePrereq @z, @max
set @z = @z + 1
end
go
As i said earlier `@i` variable exists only when `@pcntr` is `1`. Therefore when i call the stored procedure for the second time and so forth the control cannot enter the if block therefore @i variable wouldn't even exist. But the script prints the value in `@i` in each iteration, How comes this is possible should it throw an error saying `@i` variable does not exist when `@pcntr` values is greater than `1`?
View 1 Replies
View Related
Jan 2, 2007
Hi,
for some reasons, I have to get access to the TaskHost during validation and execution. For example, I wanna know, if my task is within a container or not (parent is Sequence).
For the UI during design time, there is the TaskHost parameter. What about the execution time or during validation?
Any hints?
Thanks.
Thorsten
View 12 Replies
View Related
Feb 2, 2007
Hi, I'm using Reporting Services on my website and for some reports, i get the timeout error after 30 secs.
I declared my object using the Reporting tools and I am using ObjectDataSource.
My report is declared in my aspx page:
<rsweb:reportviewer id="ReportViewer1" runat="server" font-names="Verdana" font-size="8pt" Width="100%" Height="600px">
My ObjectDataSource is declared in my aspx page under my report tag:
<asp:ObjectDataSource ID="ObjectDataSource" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetData" TypeName="ReportsTableAdapters.ViewingTotalsTableAdapter">
My TableAdapter is declare in my Reports.xsd file:
<TableAdapter BaseClass="System.ComponentModel.Component" DataAccessorModifier="AutoLayout, AnsiClass, Class, Public" DataAccessorName="ViewingTotalsTableAdapter" GeneratorDataComponentClassName="ViewingTotalsTableAdapter" Name="ViewingTotals" UserDataComponentName="ViewingTotalsTableAdapter">
I am trying to access the TableAdapter object from my WebPage Class on the Page_Load event , so I can modify the Command.CommandTimeout. Unfortunately, I cannot find a way to have access to the TableAdater object.
Anyone has any suggestion ?
Thanks,
Richard
View 1 Replies
View Related
Mar 28, 2007
I have been using the .NET Enterprise Library for DataAccess patterns for some time now. I'm going back to a bunch of old legacy ADO code written in VB6/VB5 and would like to try and create the same "centralized" class that all of my code can instantiate and call to open database objects, call stored procedures, etc.
Does anyone know of any samples of papers which might describe this?
Thanks very much,
...Andrew
View 1 Replies
View Related
Jun 23, 2014
i am currently working on designing a database for a bank as a school project for my database class. We have to draw up an entity relationship diagram, Sql tables, database size estimate etc. I am currently working on the security portion of the project. I need to list the groups that have access to my application and use a grid format to show access to specific tables.
I am currently working on designing a database for a bank as a school project for my database class. We have to draw up an entity relationship diagram, Sql tables, database size estimate etc. I am currently working on the security portion of the project. I need to list the groups that have access to my application and use a grid format to show access to specific tables.
Role Loans Payments Transactions Accounts Customer Emplo
Database Admin SUID SUID SUID SUID SUID SUID
Branch Manager SUI SUI SUI SUI SUI SUI
Internal Auditor S S S S S S
Loan Officer SUID SUI SUI S S
Tellers S S S S SU
Customers U
View 1 Replies
View Related
Feb 21, 2008
Hai Guys,
I have a doubt Regarding SqlDataReader
i can able to create object to Sqlconnection,Sqlcomand etc...
but i am unable to create object for SqlDataReader ?
Logically i understand that SqldataReader a way of reading a forward-only stream of rows from a SQL Server database. This class cannot be inherited.
sqlDatareader belongs to which class is it sealed or static class?
can we create own class like SqldataReader .......
Reply Me ...... if any one know the answer..............
View 8 Replies
View Related
Nov 28, 2006
Hi,
I am developing an application that uses Access database (mdb file) to store the user data. The user of this application is not interested in the database file (to view in MS Access Environment). Does the user machine requires MS Access installation to run my application or just some couple of dlls (OleDB driver, Access DB Engine,..) should be enough to run my application?
Thanks,
Rao
View 3 Replies
View Related
Jul 11, 2004
hi
i was reading book about asp.net and i found example for a dataacess class but i didn't understand this part
Private m_FieldData As New NameObjectCollection
Private _m_ConnectionString As String
Private m_dbConnection As SqlConnection
Private Sub AddParameters( _
ByVal objCommand As SqlCommand, _
ByVal objValues() As Object)
Dim objValue As Object
Dim I As Integer
Dim objParameter As SqlParameter
objCommand.Parameters.Clear()
SqlCommandBuilder.DeriveParameters(objCommand)
I = 0
For Each objParameter In objCommand.Parameters
If objParameter.Direction = ParameterDirection.Input _
Or objParameter.Direction = _
ParameterDirection.InputOutput Then
objValue = objValues(I)
objParameter.Value = objValue
I = I + 1
End If
Next
End Sub
Private Sub AddFieldParameters _
(ByVal objCommand As SqlCommand)
Dim objParameter As SqlParameter
objCommand.Parameters.Clear()
SqlCommandBuilder.DeriveParameters(objCommand)
For Each objParameter In objCommand.Parameters
objParameter.Value = _
_FieldData.Item(objParameter.ParameterName. _
Substring(1))
Next
End Sub
Public Function ExecDataReader _
(ByVal strStoredProc As String, _
ByVal ParamArray objValues() As Object) _
As SqlDataReader
Dim objCommand As SqlCommand
Dim objReader As SqlDataReader
objCommand = New SqlCommand
objCommand.CommandText = strStoredProc
objCommand.CommandType = CommandType.StoredProcedure
objCommand.Connection = dbConnection
Try
objCommand.Connection.Open()
If (objValues.Length = 0) Then
AddFieldParameters(objCommand)
Else
AddParameters(objCommand, objValues)
End If
objReader = objCommand. _
ExecuteReader(CommandBehavior.CloseConnection)
Catch ex As Exception
If objCommand.Connection.State.Open Then
objCommand.Connection.Close()
End If
End Try
Return objReader
End Function
can anybody help me what the author want to do
View 3 Replies
View Related