DataSource Controls :: Passing More Than One Parameter From Check Box List To Stored Proc?
Apr 22, 2010
lets say i have check box list like that
Cairo
Alex
Aswan
All
each of them is a check box inside this check box list and i have a stored proc that takes paramter which is the name of the city and gives me a data according to the name of the city (Filter). i wana know if i checkec more that one city how can i pass this to the stored proc eg if i checked on cairo and alex what can i do to make the filter looks like this where city Like 'Cairo' and City Like 'Alex' My Stored Proc takes @City Parameter like this Create Proc xx(@City varchar(2)) how can i pass the 2 cities 2 the stored proc
I am using DAAB with stored procedures. I use stored procedures more then once if possible. If I add a parameter later in stored procedure, I have to supply value for this in functions where it is even not being used as well, other wise it shows an error that number of parameters are not same. if I add parameter in last of parameter list in stored procedure and set a default value for it and I may have not to provide value for this from functions where I am not using it.
Trying to pass in my DataTable to a stored proc using LINQ. Below is my code.
var sqlCommand = new System.Data.SqlClient.SqlCommand { CommandType = System.Data.CommandType.StoredProcedure, CommandText = "UserIdList" }; var dataTable = new System.Data.DataTable("IdList"); dataTable.Columns.Add("AttributeIds", typeof(Int32)); dataTable.Rows.Add(26); dataTable.Rows.Add(40); dataTable.Rows.Add(41); dataTable.Rows.Add(45); dataTable.Rows.Add(78); dataTable.Rows.Add(33); dataTable.Rows.Add(36); //The parameter for the SP must be of SqlDbType.Structured var parameter = new System.Data.SqlClient.SqlParameter { ParameterName = "@AttributeIds", SqlDbType = System.Data.SqlDbType.Structured, TypeName = "ecs.IDList", Value = dataTable, }; sqlCommand.Parameters.Add(parameter); var user = myDC.DC.ExecuteQuery("exec ecs.udpUserAttributeDetails {0}, {1}", sqlCommand, userId).SingleOrDefault();
I have a GridView sourced by a SQL Server stored procedure with several databound fields, including a money column for item values. My stored proc returns the data through a SELECT and everything looks good. The stored proc also has a single output parameter that sums the total value of the displayed data, and this value is displayed in a label above the GridView.
I have made a simple stored proc which include Transaction through which I have to delete records from two tables EmpDetail and EmpDept . EmployeeId is PK in EmpDetail and FK in EmpDept. Procedure has been executed but on doing exec DelEmployee @EmployeeID='e07' showing 0 rows affected..
I've been self teaching SQL and asp.net and i'm a little stuck. I have a stored proc for the insert and then in my Insert inside my class it's not returning the ID after the insert as I am receiving an error message that NULL value has cannot be inserted. I want to add default values to a seperate table after the insert. I will provide my code below, if anyone can help me why the value is not going across?
I would like to execute a stored proc that simply updates a record. At this point I would like to keep it parameter less. But in future, I will be adding parameters to the stored proc. Can I simply do it via SQLDataSource? It will save me writing few lines of code to execute stored proc in a traditional ado.net.
I have a stored proc. that returns the USL & LSL values for each of the 8 different Metrics. say, Defect Density (Upper Specification Limit) USL = 0.30 & Defect Density (Lower Specification Limit_ LSL = 0.05). Simillarly for 8 different Metrics. Why I need these Spec. Limits ?...Because I want o compare my project's Metrics Value displayed in the Grid View with the corresponding USL & LSL value of the same Metrics. IF Metrics Value is outside of USL & LSL Then I want to Mark the Metrics in Red Color.
1. STORED PROC "Get_Spec_Limits" Does Not Return Anything 2. Error : Object Reference Not set to an Instance of an Object, in the following "OnRowDataBound' Event
OnRowDataBound="GridView1_RowDataBound" Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs) Handles GridView1.RowDataBound Dim strConnection As String = "Data Source=******;Initial Catalog=Metrics;Integrated Security=True" Dim objConnection As New SqlConnection(strConnection) Dim da As New SqlDataAdapter("Get_Spec_Limits", objConnection) da.SelectCommand.CommandType = CommandType.StoredProcedure Dim Productivity_USL As New SqlParameter("@Productivity_LSL", SqlDbType.Float) Dim Productivity_LSL As New SqlParameter("@Productivity_LSL", SqlDbType.Float) Dim IDD_LSL As New SqlParameter("@IDD_LSL", SqlDbType.Float) Dim IDD_USL As New SqlParameter("@IDD_USL", SqlDbType.Float) Dim EDD_LSL As New SqlParameter("@EDD_LSL", SqlDbType.Float) Dim EDD_USL As New SqlParameter("@EDD_USL", SqlDbType.Float) Dim DRE_FS_LSL As New SqlParameter("@DRE_FS_LSL", SqlDbType.Float) Dim DRE_FS_USL As New SqlParameter("@DRE_FS_USL", SqlDbType.Float) Dim DRE_TS_LSL As New SqlParameter("@DRE_TS_LSL", SqlDbType.Float) Dim DRE_TS_USL As New SqlParameter("@DRE_TS_USL", SqlDbType.Float) Dim DRE_Code_USL As New SqlParameter("@DRE_Code_USL", SqlDbType.Float) Dim DRE_Code_LSL As New SqlParameter("@DRE_Code_LSL", SqlDbType.Float) Dim COQ_USL As New SqlParameter("@COQ_USL", SqlDbType.Float) Dim COQ_LSL As New SqlParameter("@COQ_LSL", SqlDbType.Float) Dim COPQ_USL As New SqlParameter("@COPQ_USL", SqlDbType.Float) Dim COPQ_LSL As New SqlParameter("@COPQ_LSL", SqlDbType.Float)......................
i have one table and structure of table is like.Now i need to fetch the Resturant Name and status of Resturant ( whether it is closed or open by comparing the opening time and closingTime with currentTime).
I am Developing A Application . I want to develop this Application with Linq and used Stored proc in linq Plz give me Some suggestion How we used And If You Have Some Related Topic
I have a recordset in a gridview that comes from an outer joint that creates null values in the recordsetWhen I write to the database using stored proc defined in datasource I get dbnull error.I'm trying to process the onDeleting event in the code behind but don't know what to write or if that's the best wayI need to call a stored proc and if the last parameters value is null then the stored proc does one thing, if it's no null it does something else.However DBNull doesn't ssem to be working.
i hve crystal report which is wrking perfectly fine.. now i want to add paramter to my stored proc... but i am not able to add the same parameter on crystal report..i tried to add parameter in the parameter fields the crystal reports field explorer.. but when i verfiy database it still gives msg stored proc expects parameter which was not supplied..SQL State 42000 native error..
I'm experimenting with an example of code that I found in a book. Here is the HTML:
[Code]....
This looks fine in DesignView.
Here is the VB:
[Code]....
The page loads when I hit F5. I enter initials for a state and click the button and get this error message: 'The connectionstring property has not been initialized'. This line is green:
objConnection.Open()
I'm highly confident that the connection srting is correct. Do I need to Dim another variable or something?
I have a form that is HTML, it involves a few string questions, a radio button, and a check box question. After the form is filled out, the info is then passed to an aspx page which sends out an email with the info. I am able to pass the string questions to the email, but am having trouble passing the radio button answer and the check box answers to the aspx and to then to the email. I have the code for the HTML set, I need help with the code for the ASPX page.(it is VB) Here is the code I have so far.
HTML <form id="form" method="post" action="SendEmail.aspx" enctype="multipart/form-data" name="questions"> <div class="Qblock">Name: <input type="text" class="input" value="" name="contact_name" /></div> <div class="Qblock">Phone #: <input type="text" class="input" value="" name="contact_phone" /></div> <div class="Qblock">E-Mail: <input type="text" class="input" value="" name="contact_email" /></div> <div class="Qblock">How many years have you been in this industry?<input type="text" class="input" value="" name="contact_long" /></div> <div class="Qblock">What is your specialty?<input type="text" class="input" value="" name="contact_special" /></div> <div class="Qblock">Do you have a cell phone? <input type="radio" name="P1" value="Yes" /> Yes <input type="radio" name="p1" value="No" /> No <br /></div> <div class="Qblock">Can you do any of the following? (check all that apply)<br /> <input type="checkbox" name="ckBox" value="CustSer" /> Handle Customer Service<br /> <input type="checkbox" name="ckBox" value="ReadForm" /> Read Expense Reports<br /> <input type="checkbox" name="ckBox" value="NewCust" /> Sign Up New Customers<br /></div> ASPX Protected Sub RetrieveValues() Dim sTemp As String = String.Empty sFromName = "[URL]" sToName = "[URL]" sSubject = "Web - Contact Us Inquiry" sTemp = String.Format("{0}{1}{2}", "<<< Marketing Opportunities >>>", vbCrLf, vbCrLf) sTemp = String.Format("{0}{1}{2}{3}", sTemp, "Name: ", Request.Params("contact_name"), vbCrLf) sTemp = String.Format("{0}{1}{2}{3}", sTemp, "Phone: ", Request.Params("contact_phone"), vbCrLf) sTemp = String.Format("{0}{1}{2}{3}", sTemp, "Email: ", Request.Params("contact_email"), vbCrLf) sTemp = String.Format("{0}{1}{2}{3}", sTemp, "How many years have you been in this industry? ", Request.Params("contact_long"), vbCrLf) sTemp = String.Format("{0}{1}{2}{3}", sTemp, "What is your specialty? ", Request.Params("contact_special"), vbCrLf) End Sub
I have an .ASPX form. All I want to do is simply "Submit" the form field values into a database.
"I have been tasked with re-writing the entire .ASPX form to use "Stored Procedures" instead of a "SQL-String" to insert form values. I think I have most of the form submitting to the database, except the "Radio Buttons" just say "NULL".
I do not know how to progam the Radio Buttons to insert the value (Yes, No, N/A) the user chose into the database. I have GOOGLED but cannot find an answer, and some answers are too complex for my level of understanding at this point.
I need to take the following code and change it so it just calls a Stored Procedure. If you could show me "Stored Procedure" code and how to change my current code to work with the Sproc it would be much appriciated. Here is the code.
I have "11" groups of Radio Buttons I need to change. Here is an example of one of the rows.
<tr> <td><input type="radio" name="group1" value="yes"></td> <td><input type="radio" name="group1" value="no"></td> <td><input type="radio" name="group1" value="N/A"></td> <td><asp:Label ID="Label22" runat="server" Text="Surfaces exposed to corrosives pH between 5 and 9."></asp:Label></td> </tr>
Summary: I just want to call a stored procedure and store the value the user chose into my database.
I have stored procedure that increments a number. I am supposed to use the newly generated number and insert it into a table. My question is how do I execute the stored procedure, with a hardcoded value of 3 that it expects as a paramter, receive the number it generates as the output parameter and use it in the insert statement.
Here is the stored procedure code:
CREATE PROCEDURE [dbo].[Generate] @myid int, @next_no int output AS update mytable set mynumber=mynumber + 1, @next_no = number where myid=@myid RETURN
Here is my insert statement, that I tried and it failed: