Passing parameter for Stored Procedure to Data Adapter/Data Se

dotnet framework

    Next

  • 1. Web Setup msi
    Hi, I am trying to exclude a web folder from being included in my web setup project. I have selected "Content Files from ..." and clicked on ExcludeFilter. In this ExcludeFilter I added images\*.gif but they are still being included with project. What am I doing wrong? Thanks, J
  • 2. instant client + odp.net
    hello I need a version of the instant client with odp.net. Is that anyhow possible and with files are necessary? my applikation needs oraops10.dll thanks. roger -- ------------------------------------- Roger Bruhin Infosystem AG Bronschhoferstrasse 31 CH-9500 Wil SG
  • 3. How can cancel a validator
    I am use a RequiredFieldValidator to valid a Text box, and there are two Buttons on the forms, one for OK and one for Cancel, both are Asp.Net controls. When a user press Cancel to cancel the input, the RequiredFieldValidator also require user must enter the value. How can I do?
  • 4. OutOfMemoryException on DataTables
    Hi, In my application I have text(flat) file as input and I have to generate an XML file. The maximum input text file size can be 900MB and gererated xml may result 2+ GB. Based on the first column value from the text file, the row will be moved to any of those 23 DataTable which are created onfly. For eg. 01;- data for Table 1- 02;- data for Table 2- 03;- data for Table 3- 04;- data for Table 4- 04;- data for Table 4- 04;- data for Table 4- 04;- data for Table 4- 04;- data for Table 4- Based on the child relation, I have to create XML node, after stripping the parent-child relation column. I am using XmlTextWriter to write the xml data, which are fetched from tables based on select with different condition. The server uses 2GB RAM memory When the application process a 500MB file, it throws OutOfMemoryException. In the task manager, the utilised memory when the system throws OutOfMemoryException is 2.15 GB. But in my desktop, for the surprise, the system has 512 MB and when I load several application, the process memory reached 1GB without any OutOfMemoryException issues. Can you one help me in this regard. Thanks in advance With Regards venkatg
  • 5. How to retrieve TimeSpan from typed DataSet?
    I keep getting an InvalidCast exception when trying to do this: DataRow row = dtP.Rows.Find(projectID); bakInterval = new TimeSpan(); bakInterval = (TimeSpan)row[colBI]; //colBI is a string const Error Message: "Specified cast is not valid". As far as I know, the rowBI column is in fact a TimeSpan. Below is how the dtP table is created. The last line shows colBI created as a TimeSpan type. DataTable tblProject = database.Tables.Add("TableProject"); DataColumn project_ID = tblProject.Columns.Add("Project_ID", typeof(Int32)); project_ID.AllowDBNull = false; project_ID.Unique = true; project_ID.AutoIncrement = true; project_ID.AutoIncrementSeed = 1; project_ID.AutoIncrementStep = 1; tblProject.PrimaryKey = new DataColumn[] { tblProject.Columns[0] }; tblProject.Columns.Add("ProjectName", typeof(string)); tblProject.Columns.Add("BackupInterval", typeof(TimeSpan)); I can cast ProjectName to a string, and Project_ID to an int, but I can't cast BackupInterval to a TimeSpan. What am I doing wrong? Thanks in advance.

Re: Passing parameter for Stored Procedure to Data Adapter/Data Se

Postby Um90Y2l2 » Thu, 28 Sep 2006 01:59:03 GMT

This cmbClientList.SelectedValue.ToString() is suppose to be my value, how 
else should i set the value?

Thanks









Re: Passing parameter for Stored Procedure to Data Adapter/Data Se

Postby William (Bill)Vaughn » Thu, 28 Sep 2006 02:40:27 GMT

Sorry, I blinked and missed it.
The Fill method is executed off the DataAdapter--not the Command. It expects 
a SelectCommand to be populated with the CommandText that has the SQL SELECT 
query and the SelectCommand.Parameters collection to be populated with 
Parameters. Let's see the real code.

-- 
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________












Re: Passing parameter for Stored Procedure to Data Adapter/Data Se

Postby Um90Y2l2 » Thu, 28 Sep 2006 03:29:02 GMT

            DataSet d = new DataSet("DataSet");
            IDataAdapter apt = IDataAdapter GetAdapter(<SqlStatement>, 
CommandType.StoredProcedure );

            apt.Fill(d);
            return d;












Re: Passing parameter for Stored Procedure to Data Adapter/Data Se

Postby William (Bill)Vaughn » Thu, 28 Sep 2006 05:19:15 GMT

don't know why you're using this approach. I also don't see a GetAdapter
in the Framework object browser so it must be in the DAB or in some custom
libary. I can offer help on more conventional means, but not on this...

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

"Rotciv" < XXXX@XXXXX.COM > wrote in message
news: XXXX@XXXXX.COM ...



Re: Passing parameter for Stored Procedure to Data Adapter/Data Se

Postby Um90Y2l2 » Thu, 28 Sep 2006 23:32:02 GMT

ust curious, how different is it to pass a parameter to a data adapter as
compared to a Recordset (i.e data reader)


"William (Bill) Vaughn" wrote:


Re: Passing parameter for Stored Procedure to Data Adapter/Data Se

Postby William (Bill)Vaughn » Fri, 29 Sep 2006 00:48:42 GMT

don't know what planet you're getting your examples, but you can't pass a
parameter to a DataAdapter--only to the Command objects it manages. There is
no Recordset in the SqlClient namespace and the DataReader is a returned
data stream, not a way to execute SQL--that can only be done with a Command.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

"Rotciv" < XXXX@XXXXX.COM > wrote in message
news: XXXX@XXXXX.COM ...



Re: Passing parameter for Stored Procedure to Data Adapter/Data Se

Postby Um90Y2l2 » Fri, 29 Sep 2006 01:36:02 GMT

hanks. That cleared things out for me. I'm new to all this, just got
confused. Will try to work it out.

"William (Bill) Vaughn" wrote:


Re: Passing parameter for Stored Procedure to Data Adapter/Data Se

Postby Um90Y2l2 » Fri, 29 Sep 2006 01:53:01 GMT

asically this is what i am working with:-

protected internal abstract IDbDataParameter GetParameter(string name,
object val);

public virtual void AddParameter(string name, object val)
{
if (Command == null) { ResetCommand(); }
if (val == null) { val = DBNull.Value; }
Command.Parameters.Add(GetParameter(name, val));
}

protected abstract IDataAdapter GetAdapter(string sql, CommandType type);

public virtual DataSet Fill(string sql, CommandType type)
{
DataSet d = new DataSet("DataSet");
IDataAdapter apt = GetAdapter(sql, type);
apt.Fill(d);
return d;
}


dbConnection.AddParameter("@<Parameter>", "<Value>");
DataSet rsDataset = dbConnection.Fill("<StoredProcedure>",
CommandType.StoredProcedure);


"William (Bill) Vaughn" wrote:


Similar Threads:

1.Passing parameter for Stored Procedure to Data Adapter/Data Set

Hey all,

   I'm trying to pass a parameter into my Stored procedure to be accessed by 
my data adapter into a dataset

            db2.AddParameter("@intClientID", 
cmbClientList.SelectedValue.ToString());
            DataSet rsDataset = db2.Fill("spListMappingDetails", 
CommandType.StoredProcedure);

However, when i try to run it, it gives me an error 

{"Procedure 'spListMappingDetails' expects parameter '@intClientId', which 
was not supplied."}

Any help is appreciated.

I used a executescalar and executequery function and it has no problem. 

thanks in advance

2.Table Adapter Configuration Wizard replaces data table name with stored procedure's

Hi

When using Table Adapter Configuration Wizard if 'Use SQL Statements' is 
selected as Command Type, the data table's name in dataset is retained and 
only its data adapter's select statements are replaced. If however 'Create 
new stored procedures' is selected as Command Type, the data table name in 
replaced by the name of the newly created select stored procedure. Problem 
with this is that the data table's name needs to be put back manually.

Is there a way to keep the data table name the same and just stored 
procedures are assigned to the data table's data adapter?

Thanks

Regards 


3.Need practical advice on using single stored procedure to process data adapter commands

Im trying to minimize the number of stored procedures and was
wondering if there is any downside to using a single stored procedure
to handle the select,insert,update, and delete commands for a data
adapter.

I create the sql dataadapter using system tables to generate the
parameters and add an additional parameter to denote the type of
process.

Would appreciate any experienced criticisms.....thanks

4.Assign new stored procedure to data adapter

Hi NG,

can I assign another stored procedure as select statement to a data adapter
during runtime ?

thanxx for answer

P@rick


5.Customizing stored procedure generated by data adapter wizard.

Is it possible to customize the stored procedures that are generated by the 
Data Adapter wizard? I do not mean afterwards but I would like to customize 
the template (if any) that the Data Adapter Wizard uses to generate this 
code.

Thanks,

Patrick 


6. use existing stored procedure in data adapter configuration wizard is disabled

7. passing parameters for insert command of data adapter bound to a g

8. Passing parameters to Data Adapter



Return to dotnet framework

 

Who is online

Users browsing this forum: No registered users and 70 guest