ICommandText::Execute() Causes Mem Leaks?

Sep 12, 2007

Howdy folks!

I'm trying the VS2005 addon Deleaker for the first time, and noticed I got about 40 "heap" memory leaks after the following m_pICmdText->Execute() call. Both m_pICmdText and m_pICmdPrepare are released before exiting the program. What else could cause these leaks? I've narrowed it down to only occuring if the execute statment is called. m_ulNumExecutions is 1 and a_pwszQuery is a CREATE TABLE statement:

// Set command sql query
hr = m_pICmdText->SetCommandText(DBGUID_SQL, a_pwszQuery);
CHKHR(hr, L"Failed to set command text
", _ExitExeSql);

// Prepare command text for execution
hr = m_pICmdPrepare->Prepare(a_ulNumExecutions);
CHKHR(hr, L"Failed to prepare command text - Invalid Query
", _ExitExeSql);

for(ULONG i=0;i<a_ulNumExecutions;i++)
{
//Execute query and place results in m_pIRowset
hr = m_pICmdText->Execute(NULL, IID_IRowset, NULL, NULL, (IUnknown **) &m_pIRowset);
CHKHR(hr, L"Failed to execute SQL
", _ExitExeSql);
}

Thanks!
Jeff

View 4 Replies


ADVERTISEMENT

OLEDB Error Encountered Calling ICommandText:: Execute

Aug 4, 2007

OLEDB error encountered calling ICommandText:: execute ; hr = 0x80040e14 .
SQLSTATE : 42000 , Native Error : 3013
Error state 1 , Severity : 16
Source : Microsoft OLE DB Provider for SQL Server
Error Message : Backup Database is terminating abnormally

View 1 Replies View Related

Error 614 And Memory Leaks

Sep 24, 1998

Folks

I have gotten two 614 error messages over the past two weeks. I also have a known memory leak problem on my production server. After I have identified the data on the page, I have gone back to requery that page and have not had a problem. I am unable to run checkdb on the db, because it is to big, and I am 24x7. My question/assumption is, the data on this page gets loaded into cache, and because of the memory leaks I am getting glitches like this, has anybody out there, had this type of problem?

From BOL Error 614 is as follows:

Message Text
A row on page %Id was accessed that has an illegal length of %d in database `%.*s`.

Explanation
This error occurs when an attempt is made to access a row on a page and the actual length of the row is greater than expected. The error indicates that there is a structural problem on the database page accessed during a read or write operation, and it involves a specific row from that page.
This structural problem can occur as a result of the following:
·Hardware problem related to but not limited to the hard drive, controller, or the controller`s implementation of write caching
·A structural problem determined when loading a database dump; it may indicate a integrity problem with the database dump file

Thanks,

Doug Snyder

View 2 Replies View Related

Easy Way To Find Connection Leaks?

Jan 15, 2004

I, just like others, am experiencing problems with data leaks. I was wondering if anyone knows of a tool out there that can help pinpoint the pages with problems? I basically want to find the culprits!


Thanks,
--
Yonah

View 2 Replies View Related

MSSQL 2000 Memory Leaks

May 16, 2006

Hi,
I have one application in two different companies with MSSQL2000 running on Windows2000 Server and Windows2003 Server.
It seems that memory needed for MSSQL2000 as displayed in task manager is increased every day.
Does anybody knows anything regarding memory leaks in MSSQL2000?

How can I find what version of service pack have I installed in a MSSQL2000 server machine?

Regards,
Manolis

View 3 Replies View Related

Apparent Memory Leaks In ODBC

Oct 22, 2007

We have created a multithreaded application that reads result sets from MS SQL Server (both 2000 and 2005). The MS SQL Server app and our app reside on the same machine. We are using the latest version of ODBC32.DLL (3.526.1830.0) and SQLSRV32.DLL (2000.86.1830). Our application is written in C++ using the Visual C++ 6.0 compiler and libraries. Our app runs as a service, therefore the apparent memory leak is a real problem. Our app needs to run on a server in a closet without human intervention.

We are kicking off many user threads that each can read from the database tables. Each of the reads from the database occurs within a critical section to minimize the threads stepping on each other. The ODBC interface class follows all the steps defined in the ODBC application developers documention (see code below).

We see or app memory steadily increasing over time (we used PerfMon to monitor Private Bytes and Virtual Bytes, per ODBC documentation). If we terminate the threads which are retreiving the result sets, the memory drops back to the level noted prior to starting the threads.

The code below is admittedly inefficient, however, it should not leak memory when accessing the database. Note that it works very well, returns the result sets that we expect exactly.


SQLHENV henv = SQL_NULL_HENV;
SQLHDBC hdbc = SQL_NULL_HDBC;
SQLHSTMT hstmt1 = SQL_NULL_HSTMT;
SQLRETURN retCode;
SQLSMALLINT sColCount = 0;
CODBCInterfaceColumnList lColumnList;
CString strDSN;
CString strUID = _T("AccountName");
CString strPWD = _T("Password");
CString strServer;
CString strDatabase;
CString strDebugMsg;
if(!CreateDSN( pRecordList->m_strDefaultODBCConnect,
strDSN,
strDatabase,
strUID,
strPWD,
strServer))
{
strExceptionMsg.Format( _T("Cannot create DSN from connect string %s"),
pRecordList->m_strDefaultODBCConnect);
bReturn = true;
return bReturn;
}
if(pRecordList->m_strDefaultODBCConnect.IsEmpty())
{
bReturn = true;
return bReturn;
}
// Allocate the environment handle
retCode = SQLAllocHandle(SQL_HANDLE_ENV,NULL, &henv);

if(retCode != SQL_ERROR && retCode != SQL_INVALID_HANDLE)
{
// Set the environment to ODBC Version 3.0
retCode = SQLSetEnvAttr(henv,
SQL_ATTR_ODBC_VERSION,
(SQLPOINTER)SQL_OV_ODBC3,
SQL_IS_INTEGER);
if(retCode != SQL_SUCCESS)
{
GetErrorMsgs(hdbc, SQL_HANDLE_ENV, strDebugMsg);
}
if(retCode == SQL_SUCCESS || retCode == SQL_SUCCESS_WITH_INFO)
{
// Allocate a ODBC connection handle handle
retCode = SQLAllocHandle(SQL_HANDLE_DBC, henv, &hdbc);
if(retCode == SQL_SUCCESS || retCode == SQL_SUCCESS_WITH_INFO)
{
retCode = SQLConnect( hdbc,
(UCHAR*)(LPCTSTR)strDSN,
SQL_NTS,
(UCHAR*)(LPCTSTR)strUID,
SQL_NTS,
(UCHAR*)(LPCTSTR)strPWD,
SQL_NTS);
if(retCode != SQL_SUCCESS)
{
GetErrorMsgs(hdbc, SQL_HANDLE_DBC, strDebugMsg);
OutputDebugString(strDebugMsg);
}
if(retCode == SQL_SUCCESS || retCode == SQL_SUCCESS_WITH_INFO)
{
// Allocate a statement handle
retCode = SQLAllocHandle(SQL_HANDLE_STMT, hdbc, &hstmt1);
if(retCode == SQL_SUCCESS || retCode == SQL_SUCCESS_WITH_INFO)
{
// Fixup the select statement
retCode = SQLPrepare( hstmt1,
(UCHAR*)(LPCTSTR)pRecordList->m_strSelectStatement,
pRecordList->m_strSelectStatement.GetLength());
if(retCode == SQL_SUCCESS)
{
retCode = SQLExecute(hstmt1);
if(retCode == SQL_SUCCESS || retCode == SQL_SUCCESS_WITH_INFO)
{
retCode = SQLNumResultCols(hstmt1,&sColCount);
if(retCode == SQL_SUCCESS || retCode == SQL_SUCCESS_WITH_INFO)
{
if(sColCount > 0)
{
if(lColumnList.DescribeColumns(hstmt1, strExceptionMsg))
{
if(lColumnList.BindColumns(hstmt1, strExceptionMsg))
{
int i = 0;
while((retCode = SQLFetch(hstmt1)) != SQL_NO_DATA)
{
if(retCode != SQL_SUCCESS)
{
GetErrorMsgs(hstmt1, SQL_HANDLE_STMT, strExceptionMsg);
break;
}
else
{
// Class to hold the result set.
CTableColumnList* pColList = new CTableColumnList();
lColumnList.PopulateColumnListObject(pColList);
pRecordList->AddColumnListRecord(pColList);
}
}
}
}
}
}
}
else
{
GetErrorMsgs(hstmt1, SQL_HANDLE_STMT, strExceptionMsg);
}
}
else
{
GetErrorMsgs(hstmt1, SQL_HANDLE_STMT, strExceptionMsg);
}
retCode = SQLFreeHandle(SQL_HANDLE_STMT, hstmt1);
}
else
{
GetErrorMsgs(hstmt1, SQL_HANDLE_STMT, strExceptionMsg);
}
retCode = SQLDisconnect(hdbc);
}
else
{
GetErrorMsgs(hstmt1, SQL_HANDLE_STMT, strExceptionMsg);
}
}
retCode = SQLFreeHandle(SQL_HANDLE_DBC, hdbc);
}
}
retCode = SQLFreeHandle(SQL_HANDLE_ENV, henv);


We are at our wits end, not sure what to do next. Any help in sorting this out will be very, VERY much appreciated.

View 3 Replies View Related

Help! The Transaction Log Is Full Error In SSIS Execute SQL Task When I Execute A DELETE SQL Query

Dec 6, 2006

Dear all:

I had got the below error when I execute a DELETE SQL query in SSIS Execute SQL Task :

Error: 0xC002F210 at DelAFKO, Execute SQL Task: Executing the query "DELETE FROM [CQMS_SAP].[dbo].[AFKO]" failed with the following error: "The transaction log for database 'CQMS_SAP' is full. To find out why space in the log cannot be reused, see the log_reuse_wait_desc column in sys.databases". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.


But my disk has large as more than 6 GB space, and I query the log_reuse_wait_desc column in sys.databases which return value as "NOTHING".

So this confused me, any one has any experience on this?

Many thanks,

Tomorrow

View 5 Replies View Related

Looking For A Way To Refer To A Package Variable Within Any Transact-SQL Code Included In Execute SQL Or Execute T-SQL Task

Apr 19, 2007

I'm looking for a way to refer to a package variable within any
Transact-SQL code included in either an Execute SQL or Execute T-SQL
task. If this can be done, I need to know the technique to use -
whether it's something similar to a parameter placeholder question
mark or something else.


FYI - I've been able to successfully execute Transact-SQL statements
within the Execute SQL task, so I don't think the Execute T-SQL task
is even necessary for this purpose.

View 5 Replies View Related

SSIS Execute Package With Execute Out Of Process = True Causes ProductLevelToLow Error

Mar 6, 2008



Hi.

I have a master package, which executes child packages that are located on a SQL Server. The Child packages execute other child packages which are also located on the SQL server.

Everything works fine when I execute in process. But when I set the parameter in the mater package ExecutePackageTask to ExecuteOutOfProcess = True, I get the following error


Error: 0xC00470FE at DFT Load Data, DTS.Pipeline: SSIS Error Code DTS_E_PRODUCTLEVELTOLOW. The product level is insufficient for component "Row Count" (5349).

Error: 0xC00470FE at DFT Load Data, DTS.Pipeline: SSIS Error Code DTS_E_PRODUCTLEVELTOLOW. The product level is insufficient for component "SCR Custom Split" (6399).

Error: 0xC00470FE at DFT Load Data, DTS.Pipeline: SSIS Error Code DTS_E_PRODUCTLEVELTOLOW. The product level is insufficient for component "SCR Data Source" (5100).

Error: 0xC00470FE at DFT Load Data, DTS.Pipeline: SSIS Error Code DTS_E_PRODUCTLEVELTOLOW. The product level is insufficient for component "DST_SCR Load Data" (6149).

The child packages all run fine when executed directly, and the master package runs fine if Execute Out of Process is False.

Any help would be greatly appreciated.

Thanks

Geoff.

View 7 Replies View Related

Conditional Execute By Execute SQL Task Return Value?

Jun 25, 2007

I have a SSIS package contains an "Execute SQL Task". The SQL will raise error or succeed. However, it sounds the package won't pick up the raised error?

Or is it possible to conditional run other control flow items according the the status of SQL task execution?

View 1 Replies View Related

Execute A SP In The Execute SQL Task

Jan 25, 2007

I am trying to execute a SP in the execute SQL task in SSIS 2005..

but I keep getting an error:

SSIS package "Package.dtsx" starting.
Error: 0xC002F210 at Load_Gs_Modifier_1, Execute SQL Task: Executing the query "exec Load_GS_Modifier_1 ?, ?" failed with the following error: "Could not find stored procedure 'exec Load_GS_Modifier_1 ?, ?'.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
Task failed: Load_Gs_Modifier_1
SSIS package "Package.dtsx" finis


I have set up two user parameters: startdate and enddate.. I am not sure what I am doing wrong????

View 3 Replies View Related

Trigger Not Execute Some Data Or Insert Not Execute A Trigger For Some Data

Mar 3, 2008

I have trigger, but not execute somedata because insert few row in every second. I use java to insert data to SQL server 2005. Data inserted to a table but not executing trigger for some data.
For example 100 data every second inserted to a table.

If insert data one by one to a table trigger fires success.
Please Help me.

View 1 Replies View Related

Using Execute

Sep 24, 2002

I am trying to return a recordset to an ASP page from a stored procedure.

The stored procedure creates a temporary table and then builds an SQL statement into a string declared with the SP. The string contains an INSERT INTO statement to insert into the temporary table and followed by a select of the rows I wish to insert into the table.

I then use the EXECUTE method to execute the SQL string. After this I have a SELECT which should select from the temporary table and return the rows i am interested in from the stored procedure.

For some reason this does not seem to work. If I execute the SP from query analyzer I get the resultset returned. However when I try to call the stored procedure from my ASP no recordset is returned. I have done this type of thing before and it has worked perfectly. Does anyone have any ideas why this may not be working? Many Thanks.

View 2 Replies View Related

Execute SQL From EM

Oct 28, 2001

Newbie Question: I'm in EM and I want to execute a simple SQL statement (e.g. exec a sproc). How do I do it? Do I have to fire up QA? or is there a simpler way?

View 1 Replies View Related

Execute (hex)

Oct 4, 2004

I don't remember where I saw it, but it looked something like this: ...exec (0x0A738... The result was identical to executing: select getdate() Anybody seen it anywhere?

View 4 Replies View Related

How To Execute SP

Mar 26, 2004

hi all,

i am having stored procedure like the below one:


create procedure pro_emplname
@name varchar
as
select * from employee where ename=@name

i have tried like this to execute:

exec pro_emplname kamal

but i am not getting the output....
could any one tell.....

thanks

View 1 Replies View Related

How Can I Execute *.sgl?

May 29, 2004

HI
i want to rite a sysntax in StoreProcedure that execute sysntaxes in My_file.sql .
How can i do this?
thanks

View 1 Replies View Related

Execute As 'sa'

Apr 15, 2008

I have two instances running on a machine...
The following code will run on the named instance but not on the default instance.

On the default instance I get the following error:
Cannot execute as the user 'SA', because it does not exist or you do not have permission.

However if I specify another account it does work.


use dbReport
go
DROP procedure dbo.clarktest
GO
create procedure dbo.clarktest
WITH EXECUTE AS 'SA' -- 'DomainSqlCmdShellDev'
as
EXEC xp_cmdshell 'dir'
go
grant exec on clarktest to [spexec]
exec clarktest
use master
go

Any assistance is appreciated as the developers code needs to be coded generically i.e. "sa" this is to prevent code manipulation during migrations...
Thank you

You can do anything at www.zombo.com

View 4 Replies View Related

Execute A Job From DOS

Jun 10, 2006

I want to start of run a job from DOS. I have MS SQL 2000 using Enterprise Manager.

Thank You,

Ernie

View 3 Replies View Related

How To Execute

Dec 1, 2006

hi,this is my stored procedure:


CREATE PROCEDURE loop As
declare @fromage bigint

begin

select @fromage=max(age) from emp1
end
begin
insert into loop values(@fromage)
end

how to run thi spc in sqlserver,please tell me

View 1 Replies View Related

Execute Dts

Aug 6, 2007

hi,
What is wrong with this please?
I am passing two variables to execute a ssis package.
Thanks

set @cmd = 'dtexec /f ' + @FullPackagePath + ' /set Package.Variables[User::FileName].Properties[Value];"' + @FullFilePath + '"' +
' Package.Variables[User::ConnectionPath].Properties[Value];"' + @ConnectionPath + '"'
print @cmd

error is:
Option "Package.Variables[User::ConnectionPath].Properties[Value];Data Source=server1databasename" is not valid.

please note I just retyped the data source name here.

View 5 Replies View Related

How To Use 'execute As '

Feb 27, 2008

Hi Everyone,

I have problem in applying 'execute as'.

Here is an exsample SP
Create procedure test
with execute as 'user1'
as
select * from people.dbo.profile


I have 2 accounts: user1 and user2.
user1 has permission to select data from people.dbo.profile but user2 doesn't. due to some reasons I don't want to grant select permission to user2.

I use user2 to execute this SP and get error message

The server principal "user1" is not able to access the database "people" under the current security context.


How can I solve it? I have been looking for solution for the whole morning.

Thank you in advance.

View 1 Replies View Related

EXECUTE AS

Dec 10, 2007

Hi,
I have some problems with the execute as command.

I have a proc in a database, lets call it 'source'. The proc looks like this:

create proc backup_proc

with execute as 'account2'

as

select * into destination.dbo.loaddata from source.dbo.loaddata

exec dbo.backup_proc

I also have two accounts:
account1 - limited rights
account2 - extended rights

I wan't to be able to run the proc which uses account2(extended rights) to copy a table to another database. I get this error when i try to execute the proc!
The server principal "destination" is not able to access the database "source" under the current security context.

View 1 Replies View Related

Cannot Execute MDX Via RS...

Apr 3, 2007

Hi all,



I have an SQL stored procedure that executes the following MDX query over an OLAP cube:


SELECT * FROM OpenRowset(''MSOLAP.3'',''DATASOURCE=localhost;Initial Catalog=Analysis Services Project1;'','select {[Measures].[Qty]} on columns from [DB ATEST]')



If I call the stored procedure from Management Studio, it executes perfectly well and returns the result I am expecting: the result of the MDX query.



However, when I call this same stored procedure from Reporting Services, as I try to build up a new report, I get the following message:



TITLE: Microsoft Report Designer
------------------------------

An error occurred while executing the query.
Cannot initialize the data source object of OLE DB provider "MSOLAP.3" for linked server "(null)".
The OLE DB provider "MSOLAP.3" for linked server "(null)" reported an error. The provider did not give any information about the error.
SELECT * FROM OpenRowset('MSOLAP.3','Initial Catalog=DB ATEST;','select {[Measures].[Qty]} on columns from [DB ATEST]')

------------------------------
ADDITIONAL INFORMATION:

Cannot initialize the data source object of OLE DB provider "MSOLAP.3" for linked server "(null)".
The OLE DB provider "MSOLAP.3" for linked server "(null)" reported an error. The provider did not give any information about the error.
SELECT * FROM OpenRowset('MSOLAP.3','Initial Catalog=DB ATEST;','select {[Measures].[Qty]} on columns from [DB ATEST]') (Microsoft SQL Native Client)



I've tried it with both an SQL Server and a OLE DB datasource.

I'm connecting locally on my PC (localhost).



Any clues as to why this works via Management Studio but not when called from RS ????



Many thanks to all,



John

View 4 Replies View Related

How To Execute

Mar 8, 2007

I have a job that requires me to call and execute a SSIS package as the first step in a SQL2k5 Stored Procedure.

Can someone please give me a basic DTEXEC example?

Thanks in advance !

View 3 Replies View Related

Can't Execute Sp In Vb.net

Mar 19, 2007

Hellou
I'm trying to execute simple sp with 5 input parmeters from vb.net. This sp works great when it is run from SQL Server management studio, but when I want to execute it from vb.net, I allways get this error:
"Syntax error, permission violation, or other nonspecific error"
Here's the code:

Cnn.Open("...")



Comm.ActiveConnection = Cnn

Comm.CommandType = ADODB.CommandTypeEnum.adCmdStoredProc

Comm.CommandText = "spSklVnos-Prenos" 'that's thename of the sp

RetParam.Direction = ADODB.ParameterDirectionEnum.adParamOutput

RetParam.Type = ADODB.DataTypeEnum.adInteger

Comm.Parameters.Append(RetParam)

P1.Direction = ADODB.ParameterDirectionEnum.adParamInput

P1.Type = ADODB.DataTypeEnum.adVarChar

P1.Size = 1

P1.Value = LocParA

Comm.Parameters.Append(P1)

P2.Direction = ADODB.ParameterDirectionEnum.adParamInput

P2.Type = ADODB.DataTypeEnum.adInteger

P2.Value = LocPar1

Comm.Parameters.Append(P2)

P3.Direction = ADODB.ParameterDirectionEnum.adParamInput

P3.Type = ADODB.DataTypeEnum.adInteger

P3.Value = LocPar2

Comm.Parameters.Append(P3)

P4.Direction = ADODB.ParameterDirectionEnum.adParamInput

P4.Type = ADODB.DataTypeEnum.adInteger

P4.Value = LocPar3

Comm.Parameters.Append(P4)

P5.Direction = ADODB.ParameterDirectionEnum.adParamInput

P5.Type = ADODB.DataTypeEnum.adInteger

P5.Value = PrevzemIDx

Comm.Parameters.Append(P5)

Comm.Execute()

Am I missing something?
Thanks for any suggestion.
Dido

View 1 Replies View Related

Execute Procedure

Feb 7, 2007

Hello,I have an SQL procedure as follows:  ...   INSERT dbo.Levels (LevelName)  VALUES (@LevelName)  ...  LevelName is an input parameter of nvarchar type.  What should be the best way to execute this procedure from my C# / VB.Net code? And what would it return?Thanks,Miguel 

View 7 Replies View Related

Execute Scalar ?

Sep 20, 2007

I'm trying to do something like the code below, but it's saying "specified cast is not valid"
If i change the value returned to an "int", it works fine. My issue is, i'd like to get the value returned with more accuracy than an int as there will be 2 decimal places.protected float getProjectHours(string project)
{string selectCmd = "SELECT SUM(hours) FROM tasks WHERE project=@project";
string strConnection = ConfigurationManager.ConnectionStrings["TimeAccountingConnectionString"].ConnectionString;SqlConnection myConnection = new SqlConnection(strConnection);
SqlCommand myCommand = new SqlCommand(selectCmd, myConnection);myCommand.Parameters.Add(new SqlParameter("@project", SqlDbType.VarChar));myCommand.Parameters["@project"].Value = project;
myConnection.Open();float total = (float)myCommand.ExecuteScalar();
myConnection.Close();
return total;
}

View 6 Replies View Related

How Do You Execute Udf Functions From ADO .net

Mar 25, 2008

 I hope this is a right form for ADO .net type of question. 
 My question is, can you call SQL function the way you call stored procedure from ADO .net.  I coded it this way and does not seems to be getting result set back.  The DataReader is seems to be coming back with nothing.  Can someone post an example.  I know you can write "SELECT udf_function()" but I really mean the way the stored procedure is called.  Thanks.
 

View 2 Replies View Related

Can't Execute Sql In Code-behind

Apr 18, 2008

 I found a example of using a button inside of a gridview at http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.buttonfield.aspx.I modified the code-behind and added:      // Insert the producer into the database      SqlDataSource sds = selectedRow.FindControl("sqlItemInsertIntoListing") as SqlDataSource;      sds.Insert(); but the page throws an error.Can someone look at my code-behind and show me how to execute the line 56 in the code-behind?  Thanks.   Object reference not set to an instance of an object.



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.NullReferenceException: Object reference not set to an instance of an object.

Source Error:




Line 55: // Insert the producer into the databaseLine 56: SqlDataSource sds = selectedRow.FindControl("sqlItemInsertIntoListing") as SqlDataSource;Line 57: sds.Insert();Line 58:Line 59: } Below is my code: ASPX PAGE:    <asp:Label ID="Message" ForeColor="Red" runat="server" AssociatedControlID="CustomersGridView" />    <!-- Populate the Columns collection declaratively. -->    <asp:GridView ID="CustomersGridView" DataSourceID="CustomersSqlDataSource" DataKeyNames="ItemID"        AutoGenerateColumns="False" OnRowCommand="CustomersGridView_RowCommand"         runat="server" AllowPaging="True" AllowSorting="True" PageSize="50">        <Columns>            <asp:BoundField DataField="ProducerName" HeaderText="Producer" SortExpression="ProducerName" />            <asp:BoundField DataField="ItemName" HeaderText="Item" SortExpression="ItemName" />            <asp:BoundField DataField="Year" HeaderText="Year" SortExpression="Year" />            <asp:BoundField DataField="RegionMasterName" HeaderText="Region" SortExpression="RegionMasterName" />            <asp:BoundField DataField="CountryName" HeaderText="Country" SortExpression="CountryName" />            <asp:BoundField DataField="StateName" HeaderText="State" SortExpression="StateName" />            <asp:TemplateField HeaderText="ItemID" InsertVisible="False" Visible="false" SortExpression="ItemID">                <ItemTemplate>                    <asp:Label ID="ItemID" runat="server" Text='<%# Bind("ItemID") %>' Visible="false"></asp:Label>                    <asp:SqlDataSource ID="sqlItemInsertIntoPart" runat="server" ConnectionString="<%$ ConnectionStrings:VBJimboConn %>"                        InsertCommand="INSERT INTO [ZCPart] ([PartUserId], [PartItemID]) VALUES (@PartUserId, @PartItemID)" OnInserting="sqlItemInsertIntoPart_Inserting" >                        <InsertParameters>                            <asp:Parameter Name="PartUserId" />                            <asp:ControlParameter Name="PartItemID" ControlID="ItemID" PropertyName="Text" Type="Int32" />                        </InsertParameters>                    </asp:SqlDataSource>                </ItemTemplate>            </asp:TemplateField>            <asp:ButtonField ButtonType="Button" CommandName="Select"                Text="Add to Part" Visible="True" />            <asp:HyperLinkField DataNavigateUrlFields="ItemID"                 DataNavigateUrlFormatString="ItemDetails.aspx?ItemID={0}" Text="Details" />        </Columns>    </asp:GridView>        <asp:SqlDataSource ID="CustomersSqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:CONNSTG %>"....>        </asp:SqlDataSource>  CODE-BEHIND:using System;using System.Collections;using System.Configuration;using System.Data;using System.Linq;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.HtmlControls;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Xml.Linq;partial class Inventory_InventoryList : System.Web.UI.Page{    protected void Page_Load(object sender, System.EventArgs e)    {        if (!Page.IsPostBack)        {            if (!User.Identity.IsAuthenticated)            {                CustomersGridView.Columns[CustomersGridView.Columns.Count - 2].Visible = false;            }        }    }    protected void sqlItemInsertIntoPart_Inserting(object sender, System.Web.UI.WebControls.SqlDataSourceCommandEventArgs e)    {        e.Command.Parameters["@PartUserId"].Value = Membership.GetUser().ProviderUserKey;    }// Source for gvInventoryList to display message: http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.buttonfield.aspx  protected void CustomersGridView_RowCommand(Object sender, GridViewCommandEventArgs e)  {    // If multiple ButtonField column fields are used, use the    // CommandName property to determine which button was clicked.    if(e.CommandName=="Select")    {      // Convert the row index stored in the CommandArgument      // property to an Integer.      int index = Convert.ToInt32(e.CommandArgument);          // Get the last name of the selected author from the appropriate      // cell in the GridView control.      GridViewRow selectedRow = CustomersGridView.Rows[index];      TableCell contactName = selectedRow.Cells[1];      string contact = contactName.Text;        // Display the selected author.      Message.Text = "You selected " + contact + ".";            // Insert the producer into the database      SqlDataSource sds = selectedRow.FindControl("sqlItemInsertIntoListing") as SqlDataSource;      sds.Insert();    }  }}

View 2 Replies View Related

How To Write And Execute?

Jun 18, 2008

 
Hi all,
      i want to write a stored procedure to get the user details from userprofile table based on the time schedule from another table called reminders.
   the structure of reminder table is called
       jobtype - type of job that is sending mails to user or sending mails to employee like that
       frequency - how frequenctly sending mails that is daily or weekly or monthly
       weekday    -  if the above option is weekly then we have to take which day on weekly to send mail
       dayofmonth - if the frequency option is monthly then we have to take this field for which day on month
      jobtime - At what time to send mails it may be daily or weekly or monthly
so i want to write the stored procedue based on above values to execute some task( that is getting userdetails and sending mails).
please help me.
Thanks!

View 6 Replies View Related

How To Execute A SQL (.sql) Script From Within VB?

Jul 13, 2004

Hello,

I am trying to figure out the best way to make VB6 execute an auto-generated .SQL file from SQL Server 2000.

SQL Server 2000 has created a script (about 1000 lines long), creating views and SPs, and I need to execute said script from a VB client application. Similar to the effect of pasting it into the Query Analyser, only automated.

Anyone have a suggestion (besides reformatting evey like and hard-coding it?)

Thanks a ton!

View 2 Replies View Related

Execute .sql From Code?

Mar 31, 2005

How can I execute am .sql script that was generated from SQL Server?

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved