Submit Users ID With Results.

Mar 8, 2007

Hi

I am trying to create a Quiz system and i need to put the user's Unique ID in the Result Data Table, so that the when they submit there results it puts there Unique ID by the side so that they can view it in there profile, and not anyone elses.

 Thanks

 Gareth Cork

View 1 Replies


ADVERTISEMENT

Different Query Results For Different Users?

Apr 22, 2008

I have an SQL2K5 database where a group of users share a custom database role and access the database via trusted connections (Windows authentication).

I have a stored procedure which reports all of the users in this database role using an SQL statment something like this:

select name
from sysusers
inner
join sysmembers on
sysmembers.memberuid=sysusers.uid
and sysmembers.groupuid=7

As the programmer, and the dbo, when I log in to execute this query, I get the list of a dozen, or so, users.

When one of the users executes the same query, they only see a return of their own username.

I'd like to have the users be able to execute this query and get the full list of users. Can someone tell me how to accomplish this?

I assume that this is some security, or permissions, thing involving system tables, or Windows authentication security.

Thank you.

BTW--the users never actually directly execute the stored procedure I mentioned; They are using a VB client application that affects the execution.

View 4 Replies View Related

Results From Query Are TRUE And FALSE But Users Wanting YES And NO

Jan 7, 2004

Hi everyone.

I've got a Select query that pulls out some data from my database. Two of the columns are both booleans (bit's of size 1) so they come back as TRUE and FALSE - which I thought was fine.

However, the users are wanting to see YES and NO since they find TRUE and FALSE confusing (yes I know how silly that sounds).

Is there any way I can do this?

My query is like this:
SELECT [stuff], [things] FROM [table1], [table2] WHERE [table1].[condition] = [table2].[condition]

Thanks
Andrew

View 4 Replies View Related

Is It Possible To Restrict The Users To Export Report Results Only To Excel ?

Jan 2, 2007

Is it possible to restrict the Users to Export Report Results only to Excel ?

So instead of the default drop down options of csv, pdf, tiff,Web Archive,Web Archive etc... can we get it to just display Excel.

Any help would be appreciated.

View 1 Replies View Related

Submit To SQL Database

Dec 6, 2006

Hi I am totally new programing and thought I would try my hands on ASP.NET 2.0.  I created a web form that would take user information and submit it to a SQL database.  However I am not sure how to properly setup the SQL connection.  What am I doing wrong?default.aspx.cs:using System;using System.Data;using System.Configuration;using System.Collections;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Web.UI.HtmlControls;public partial class _Default : System.Web.UI.Page{    protected void MultiView1_ActiveViewChanged(object sender, EventArgs e)    {    }    protected void Button1_Click1(object sender, EventArgs e)    {        String ConnStr = "Data Source=TECATE;Initial Catalog=subscribe_mainSQL;Integrated Security=True";        String SQL = "Insert into main (email,fname,lname,userid,status) values ('" + email.Text + "', " + fname.Text + "','" + lname.Text + "','" + userid.Text + "','" + degree.SelectedItem.Value + "')";    }}   default.aspx:<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" EnableSessionState="True" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server">    <title>Email Sign Up Page</title></head><body style="text-align: center">    <form id="form1" runat="server">        <asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="0" OnActiveViewChanged="MultiView1_ActiveViewChanged">            <asp:View ID="signup" runat="server">        <br />        <table style="background-color: #f0f0f0" width="450">            <tr>                <td style="width: 18px; height: 23px">                </td>                <td style="font-weight: bold; font-size: medium; width: 383px; color: black; font-family: verdana;                    height: 23px">                    Email Subcribe System</td>                <td style="width: 19px; height: 23px">                </td>            </tr>        </table>        <table style="color: white; font-family: verdana; background-color: #5d7b9d" width="450">            <tr>                <td style="width: 19px; height: 20px">                </td>                <td align="center" style="width: 153px; height: 20px">                    &nbsp;</td>                <td align="left" style="width: 18px; height: 20px">                </td>                <td style="width: 115px; height: 20px">                </td>            </tr>            <tr>                <td style="width: 19px">                </td>                <td align="left" style="width: 153px">                    <asp:Label ID="Label1" runat="server" Font-Names="Verdana" Font-Size="X-Small" Text="First Name:"></asp:Label></td>                <td align="left" style="width: 18px">                </td>                <td align="left" style="width: 115px">                    <asp:Label ID="Label2" runat="server" Font-Names="Verdana" Font-Size="X-Small" Text="Last Name:"></asp:Label></td>            </tr>            <tr>                <td style="width: 19px; height: 26px">                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="fname"                        ErrorMessage="*" ForeColor="White"></asp:RequiredFieldValidator></td>                <td align="left" style="width: 153px; height: 26px">                    <asp:TextBox ID="fname" runat="server" MaxLength="20"></asp:TextBox></td>                <td align="left" style="width: 18px; height: 26px">                    <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="lname"                        ErrorMessage="*" ForeColor="White"></asp:RequiredFieldValidator></td>                <td align="left" style="width: 115px; height: 26px">                    <asp:TextBox ID="lname" runat="server" MaxLength="20"></asp:TextBox></td>            </tr>            <tr>                <td style="width: 19px; height: 9px">                </td>                <td align="left" style="width: 153px; height: 9px">                    <asp:Label ID="Label3" runat="server" Font-Names="Verdana" Font-Size="X-Small" Text="10 Digit USC ID:"></asp:Label></td>                <td align="left" style="width: 18px; height: 9px">                </td>                <td align="left" style="width: 115px; height: 9px">                    <asp:Label ID="Label4" runat="server" Font-Names="Verdana" Font-Size="X-Small" Text="USC Email:"></asp:Label></td>            </tr>            <tr>                <td style="width: 19px">                    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="uscid"                        ErrorMessage="*" ForeColor="White"></asp:RequiredFieldValidator></td>                <td align="left" style="width: 153px">                    <asp:TextBox ID="uscid" runat="server" MaxLength="10"></asp:TextBox></td>                <td align="left" style="width: 18px">                    <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="email"                        ErrorMessage="*" ForeColor="White"></asp:RequiredFieldValidator></td>                <td align="left" style="width: 115px">                    <asp:TextBox ID="email" runat="server"></asp:TextBox></td>            </tr>            <tr>                <td style="width: 19px">                </td>                <td align="left" style="width: 153px">                    <asp:Label ID="Label5" runat="server" Font-Names="Verdana" Font-Size="X-Small" Text="Degree Status:"></asp:Label></td>                <td align="left" style="width: 18px">                </td>                <td align="left" style="width: 115px">                    <asp:Label ID="Label6" runat="server" Font-Names="Verdana" Font-Size="X-Small" Text="Confirm USC Email:"></asp:Label></td>            </tr>            <tr>                <td style="width: 19px">                    <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="degree"                        ErrorMessage="*" ForeColor="White"></asp:RequiredFieldValidator></td>                <td align="left" style="width: 153px">                    <asp:DropDownList ID="degree" runat="server">                        <asp:ListItem></asp:ListItem>                        <asp:ListItem>Undergraduate</asp:ListItem>                        <asp:ListItem>Graduate</asp:ListItem>                        <asp:ListItem Value="PhD">Ph.D</asp:ListItem>                    </asp:DropDownList>&nbsp;                </td>                <td align="left" style="width: 18px">                </td>                <td align="left" style="width: 115px">                    <asp:TextBox ID="confirmemail" runat="server"></asp:TextBox></td>            </tr>            <tr>                <td style="width: 19px; height: 21px">                </td>                <td align="left" style="width: 153px; height: 21px">                    &nbsp;                </td>                <td align="left" style="width: 18px; height: 21px">                </td>                <td align="right" style="width: 115px; height: 21px">                </td>            </tr>            <tr>                <td style="width: 19px; height: 21px">                </td>                <td align="left" style="width: 153px; height: 21px">                    <br />                    <asp:CompareValidator ID="CompareValidator1" runat="server" ControlToCompare="email"                        ControlToValidate="confirmemail" ErrorMessage="*Emails Do Not Match" Font-Names="Verdana"                        Font-Size="X-Small" ForeColor="White"></asp:CompareValidator>                </td>                <td align="left" style="width: 18px; height: 21px">                </td>                <td align="right" style="width: 115px; height: 21px">                    <asp:Button ID="Button1" runat="server" CommandName="NextView" Font-Bold="True" Font-Names="Verdana"                        Font-Size="Small" OnClick="Button1_Click1" Text="Submit" /></td>            </tr>        </table>                <div align="center">                    &nbsp;&nbsp;                    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConflictDetection="CompareAllValues"                        ConnectionString="<%$ ConnectionStrings:subscribe_mainSQLConnectionString %>"                        InsertCommand="INSERT INTO [main] (, [uscid], [fname], [lname], [degree]) VALUES (@email, @uscid, @fname, @lname, @degree)"                        OldValuesParameterFormatString="original_{0}" SelectCommand="                        WHERE = @original_email AND [uscid] = @original_uscid AND [fname] = @original_fname AND [lname] = @original_lname AND [degree] = @original_degree">                        <InsertParameters>                            <asp:Parameter Name="email" Type="String" />                            <asp:Parameter Name="uscid" Type="String" />                            <asp:Parameter Name="fname" Type="String" />                            <asp:Parameter Name="lname" Type="String" />                            <asp:Parameter Name="degree" Type="String" />                        </InsertParameters>                    </asp:SqlDataSource>                </div>            </asp:View>            <asp:View ID="thankyou" runat="server">                <br />                <table style="background-color: #f0f0f0" width="450">                    <tr>                        <td style="width: 18px; height: 23px">                        </td>                        <td style="font-weight: bold; font-size: medium; width: 383px; color: black; font-family: verdana;                    height: 23px">                            Email Subcribe System</td>                        <td style="width: 19px; height: 23px">                        </td>                    </tr>                </table>                <div align="center">                    <br />                    <br />                    <br />                    <asp:Label ID="Label7" runat="server" Font-Bold="True" Font-Names="Verdana" Font-Size="Small"                        Text="Thank you for registering."></asp:Label>&nbsp;</div>            </asp:View>        </asp:MultiView><div align="center">&nbsp;</div>    </form></body></html> 

View 6 Replies View Related

SQL-Server Job Submit From Web Page Using C#

Jun 20, 2008

Is it possible to submit a existing sql-server job from web page by using C#.
 
 

View 2 Replies View Related

How To Submit A Form To An SQL Database?

Feb 3, 2004

I have a registration form, and upon the user clicking the submit button, I want the information to be processed and sent to my SQL database. Each textbox (i.e. username, password, email address) has a corresponding field in a table in the database.

How can I accomplish this? I under stand that I will need an onclick event handler.

View 1 Replies View Related

Submit Form To Database

Dec 7, 2005

Old Frontpage user here... I need to submit a form to a database, like in Frontpage and store the database on the web server.
How do I accomplish this with Visual Studio Express...is there a ASP.NET component or do I need to code it?
Many Thanks,
Jake
p.s. my ASP.NET 2.0 books are coming for Christmas!

View 1 Replies View Related

Submit Query As A Scheduled Job....

Dec 25, 2002

I need to have an way to automatically submit a sql query in Sql
2000 - the query joins several lables and exports the info to a file.
Right now I've been doing it interactively in Query analyzer and
using the export to option... I can't use DTS (query way too
complicated!) and the file created is >255 lrecl so that seems to be
a big problem too!

Any suggestions? Save me from this same predicament on New Years Day!
Thanks and Happy Holidays! :(

View 1 Replies View Related

Cant Submit Any Sort Of Variable Data

Feb 27, 2008

Hi there, i have written a page and for a long time it worked (or so i thought) now all of a sudden it dosnt. I have gone right back to basics and tried to only insert one variable, tried using a text box, a string pre populated, or a string populated by the text box - nothing seems to work. However if i hard code in the thing that i want, even into the SQL or into my param it works, whats going on! i think my programming skills are letting me down here!
here is what i am trying to use (as you can see i have commented out all that i was using to get back to basics)
Are there any pointers?SqlConnection objConnAddStock = new SqlConnection(sAddStock);
//This is the sql statement.
 int intUpdateQSStockID = Convert.ToInt32(Request.QueryString["qsStockID"]);
string strCondition;strCondition = "Brand New 12";using (objConnAddStock)
{
objConnAddStock.Open();string sqlAddStock = "UPDATE tbl_stock SET condition = @condition WHERE stock_id = " + intUpdateQSStockID;
 
 
 
 
 /*cat_id = @cat_id, sub_cat_id = @sub_cat_id, n_or_sh = @n_or_sh, " +
"description = @description, size = @size, colour = @colour, cost_price = @cost_price, " +
"selling_price = @selling_price, condition = @condition, notes = @notes, " +
"buying_in_recipt = @buying_in_recipt, visible = @visible, picture1 = @picture1, " +
"picture2 = @picture2, [picture3] = @picture3, picture4 = @picture4, " +
"picture1_thumb = @picture1_thumb, picture2_thumb = @picture2_thumb, " +
"picture3_thumb =@picture3_thumb, picture4_thumb = @picture4_thumb, title = @title, " +
"display_price = @display_price WHERE Stock_id = " + intUpdateQSStockID;*/
 SqlCommand objCmdAddStock = new SqlCommand(sqlAddStock, objConnAddStock);
objCmdAddStock.Parameters.AddWithValue("@condition", conditionTextBox.Text);/* objCmdAddStock.Parameters.AddWithValue("@cat_id", DropDownList2.SelectedValue);
objCmdAddStock.Parameters.AddWithValue("@sub_cat_id", DropDownList1.SelectedValue);
objCmdAddStock.Parameters.AddWithValue("@n_or_sh", n_or_shTextBox.Text);
objCmdAddStock.Parameters.AddWithValue("@description", txtDescription.Text);
objCmdAddStock.Parameters.AddWithValue("@size", sizeTextBox.Text);
objCmdAddStock.Parameters.AddWithValue("@colour", colourTextBox.Text);
objCmdAddStock.Parameters.AddWithValue("@cost_price", cost_priceTextBox.Text);
objCmdAddStock.Parameters.AddWithValue("@selling_price", selling_priceTextBox.Text);
objCmdAddStock.Parameters.AddWithValue("@condition", conditionTextBox.Text);
objCmdAddStock.Parameters.AddWithValue("@notes", notesTextBox.Text);
objCmdAddStock.Parameters.AddWithValue("@buying_in_recipt", TextBox3.Text);
objCmdAddStock.Parameters.AddWithValue("@visible", DropDownList4.SelectedValue);
objCmdAddStock.Parameters.AddWithValue("@picture1", txtPicture1.Text);
objCmdAddStock.Parameters.AddWithValue("@picture2", txtPicture2.Text);
objCmdAddStock.Parameters.AddWithValue("@picture3", txtPicture3.Text);
objCmdAddStock.Parameters.AddWithValue("@picture4", txtPicture4.Text);
objCmdAddStock.Parameters.AddWithValue("@picture1_thumb", txtPicture1_thumb.Text);
objCmdAddStock.Parameters.AddWithValue("@picture2_thumb", txtPicture2_thumb.Text);
objCmdAddStock.Parameters.AddWithValue("@picture3_thumb", txtPicture3_thumb.Text);
objCmdAddStock.Parameters.AddWithValue("@picture4_thumb", txtPicture4_thumb.Text);
objCmdAddStock.Parameters.AddWithValue("@title", txtTitle.Text);
objCmdAddStock.Parameters.AddWithValue("@display_price", txtDisplay.Text);*/
 
try
{
objCmdAddStock.ExecuteNonQuery();
}catch (Exception ex)
{Label17.Text = Convert.ToString(ex);
}finally
{
objConnAddStock.Close();
}Label17.Text = Convert.ToString(intUpdateQSStockID);
 
}

View 3 Replies View Related

How Submit Db_name() As Default Parameter ?

Mar 8, 2006

Hi,
I want to submit db name as as default parameter when calling procedure WITHOUT using variables

Example
use master
go

create procedure get_caller_db @s sysname = DB_NAME() --produce error
as
select @s as [caller db name]

go
use mySuperDB
exec master.dbo.get_caller_db
--
caller db name
--------------
mySuperDB -- result I want

View 2 Replies View Related

Total Monthly Expenses Don't Sum Up When I Submit

Oct 15, 2006

I have a Monthlyexpense column. How do I Sum up this column and put the Total in my ytdexpenses column. Do I use a stored procedure, because I want the monthlyExpenses to SUm up every time I submit a monthly expense to the database and siplay in the ytdExpenses Column.
When I Write a Query all of the rows in the ytdExpenses shows the same amount and do not total up every time I submit to the database. Help please.

monthlyExpenses   ytdExpenses
$1,000    $1,000
$2,000    $3,000
$3,000    $6,000
$2,000    $8,000
$5,000    $13,000

View 20 Replies View Related

Asp.net Form Submit To Sql Server Express

Sep 30, 2007

pls i have asp.net page that i want to connect to sql server express edition database and i want data to be submited from the page into sql server express edition database that i have in my project folder when i click on submit button pls help me with the code to do this

View 1 Replies View Related

Multi Value Parameter Cleared On Submit

Aug 17, 2007

I have a report created in Reporting Services that contains 5 parameters. Two are text [date] fields, and three are drop-down multi-value parameters. One is driven from the result of another, and both of those work fine. My issue is with the final multi-value parameter, which is simply a list of customers. It gets populated from the data set without a problem, and I can select from 1 to all of the options. However, on submitting the report. This one parameter gets cleared out, the report does not run, but instead waits for me to select the customers (again) and resubmit.

Occasionally, I can select a few customers and it will, in fact, run the report. However, 90% of the time it just clears the field and waits.

I can trace the database, and everything looks normal - on submit nothing is sent to the database, so it's not like there's a problem with the query. I've verified the customer table and all records look similar - I don't see any obvious data issues.

Suggestions?

View 4 Replies View Related

Insert Same Data To Two Different Tables With One Submit Button....

Apr 8, 2004

I would like to insert a set of data to my database to 2 different tables.
what will be the SQL Statement for such ? Is it possible to do so?

for example, a webpage contain 2 textbox which require user to key in data. Once click submit button. the info will saved to 2 tables....

View 3 Replies View Related

Forms To View / Edit / Submit To Server

Nov 5, 2013

Currently, I have a set of data that is available on a SQL Server. I want to be able to display the information in the front-end (ie. Access form, excel, webpage?), and if the user wants to edit any information they may do so and with a click of a button, submits to the sql server.

View 1 Replies View Related

All I Wanted Was To Submit Customers Info To My Emailbox

Jan 28, 2008

I have created an order form for my business. I placed a submit button at the bottom. I wanted all the clients information to go into my emailbox. Someone told me about MS SQL Server. I got excited and downloaded the 2005 Express version with all the trimmings. Now I am more confused than I was before. Someone please explain to me what I should do first. Redo the form with the studio then work with the server? I think I may have deleted something important from the server trying to figure it out. Help!!!!!!!!!!

View 7 Replies View Related

Unable To Submit More Than 8000 Characters With Stored Procedure

Jul 20, 2005

Hi all,I have a internet page written in asp to submit into authorscurriculum vitae publications (title, author, year, etc.).If the author submit less than 8000 characters it functions OK, but Ifthe author try's to submit more than 8000 characters the asp page doesnot return an error but the text is not saved in the database or,sometimes, it returned a "Typ mismatch" error.Here is the sp:---------------------------------------------------------------------CREATE PROCEDURE sp_CV_publications(@formCommandnvarchar(255)='process',@id numeric=null,@id_personint=null,@typPubID tinyint= NULL,@publicationstext=null)ASif @formCommand='process'beginINSERT INTO CV_publications(idperson,typPubID,publications)VALUES (@id_person@typPubID,@publications);select 1 as status, @@IDENTITY AS insertedID, * FROMCV_publications WHERE id=@@IDENTITYend----------------------------------------------------------------------------The server is running IIS5 and SqlServer 2000Any ideas ???

View 1 Replies View Related

Reporting Services :: Adding (new) Child Domain Users To SSRS As System Users?

Jul 28, 2015

We have an existing SSRS server, and have just created a new child domain. We'll be migrating users from the parent to the child, and want to add the users of that new domain with access to SSRS. In the parent domain they are able to access, but after migration with the child domain account, they cannot.

I have added the group CHILDDomain Users with a system user role on SSRS, and PARENTDomain Users was already there.

Is there any additional step I should/could take to get this active?

View 5 Replies View Related

Why Out Of The Blue Would VPN Users Be Unable To Connect To Database And Local Users Are Unaffected?

Mar 6, 2008

I have had this issue just pop up. I have local users who can connect fine, but my users that require connection by VPN cannot connect. I get the server not available or access denied error. I did confirm that the VPN'ers are connected to the network correctly and can see that their shares and mappings are correct. Any ideas? Thanking you all in advance!!

View 6 Replies View Related

SQL Security :: Did Not Create Any New Users And There Are No Other Users Listed In Accounts Section

Sep 28, 2015

I am trying to revert back to Windows 7 after upgrading to Windows 10, however it will not let me and the following message occurs: "Remove new accounts.Before you can go back to a previous version of Windows, you'll need to remove any user accounts you added after the most recent upgrade. The accounts need to be completely removed, including their profiles.You created one account (NT SERVICEMSSQLSERVER) Go to Settings> Accounts> Other users to remove these accounts and then try again".However I did not create any new users and there are no other users listed in the Accounts section.

View 2 Replies View Related

Stored Procedure To Get All Users Or All Users Of A Specific Country

Apr 30, 2008

hi alli've got two tables called "webusers" (id, name, fk_country) and "countries" (id, name)
at the meantime, i've a search-page where i can fill a form to search users. in the dropdown to select the country i included an option which is called "all countries".
now the problem is: how can i make a stored procedure that makes a restriction to the fk_country depending on the submitted fk_country parameter?it should be something like
SELECT * FROM webusers(if @fk_country > 0, which is the value for "all countries"){    WHERE fk_country = @fk_country}
who has an idea how to solve this problem?

View 9 Replies View Related

Difference Between Database -- &&> Users And Security --&&> Users

Nov 28, 2006

Hi Team,

In SQL Enterprise Manager, when we expand "Database -->Users", we see the

users there. When we expand "Security --> logins" we see the same users there.

Can you differentiate these two.

Thanks

Santhosh

View 1 Replies View Related

List Users Then Disconnect Users

Jun 4, 2008

I want to be able to list all users connected/logged in a specific database and disconnect them all or a certain user.

can this be done in SQL and if so how?

View 1 Replies View Related

Users Get Blocked By Other Users Alot

Sep 26, 2007

We are using Navision with SQL server 2003.

What kind of methods is there out there to reduce hwo often this happens?

View 10 Replies View Related

Please Help Me &"Remove Srting&" On Submit.

Aug 18, 2007

Ok, my host is free and for some reason when my users submit there code inside the discreption "textarea" with this (don't) it crashes the form without sending it to the database?
But if it is sent like this (dont) its ok!

So i am working on replacing the invalid strings so it'll be ok if they forget not to do it. But i am stuck...

Function CleanInput(strIn As String) As String
' Replace invalid characters with empty strings.
Return Regex.Replace(strIn, "[^w.@-]", "")
End Function


Any help i will love you forever :P

View 7 Replies View Related

Is There A Way To Hold The Results Of A Select Query Then Operate On The Results And Changes Will Be Reflected On The Actual Data?

Apr 1, 2007

hi,  like, if i need to do delete some items with the id = 10000 then also need to update on the remaining items on the with the same idthen i will need to go through all the records to fetch the items with the same id right?  so, is there something that i can use to hold those records so that i can do the delete and update just on those records  and don't need to query twice? or is there a way to do that in one go ?thanks in advance! 

View 1 Replies View Related

SQL Server 2008 :: Elegant Way For Returning All Results When Subquery Returns No Results?

Mar 25, 2015

I have four tables: Customer (CustomerId INT, CountyId INT), County (CountyId INT), Search(SearchId INT), and SearchCriteria (SearchCriteriaId INT, SearchId INT, CountyId INT, [others not related to this]).

I want to search Customer based off of the Search record, which could have multiple SearchCriteria records. However, if there aren't any SearchCriteria records with CountyId populated for a given Search, I want it to assume to get all Customer records, regardless of CountyId.

Right now, I'm doing it this way.

DECLARE @SearchId INT = 100
SELECT * FROM Customer WHERE
CountyId IN
(
SELECT CASE WHEN EXISTS(SELECT CountyId FROM SearchCriteria WHERE SearchId = @SearchId)
THEN SearchCriteria.CountyId

[Code] .....

This works; it just seems cludgy. Is there a more elegant way to do this?

View 4 Replies View Related

Need To Display Results Of A Query, Then Use A Drop Down List To Filter The Results.

Feb 12, 2008

Hello. I currently have a website that has a table on one webpage. When a record is clicked, the primary key of that record is transfered in the query string to another page and fed into an sql statement. In this case its selecting a project on the first page, and displaying all the scripts for that project on another page. I also have an additional dropdownlist on the second page that i use to filter the scripts by an attribute called 'testdomain'. At present this works to an extent. When i click a project, i am navigated to the scripts page which is empty except for the dropdownlist. i then select a 'testdomain' from the dropdownlist and the page populates with scripts (formview) for the particular test domain. what i would like is for all the scripts to be displayed using the formview in the first instance when the user arrives at the second page. from there, they can then filter the scripts using the dropdownlist.
My current SQL statement is as follows.
SelectCommand="SELECT * FROM [TestScript] WHERE (([ProjectID] = @ProjectID) AND ([TestDomain] = @TestDomain))"
So what is happening is when testdomain = a null value, it does not select any scripts. Is there a way i can achieve the behaivour of the page as i outlined above? Any help would be appreciated.
Thanks,
James.

View 1 Replies View Related

Stored Proc Results Are Displaying In The Messages Tab Instead Of Results Tab- URGENT

May 14, 2008




Hi All,
I have a stored proc which is executing successfully...but the results of that stored proc are displaying in the Messages Tab instaed of results Tab. And in the Results Tab the results shows as 0..So, Any clue friends..it is very urgent..I am trying to call this stored proc in my Report in SSRS as well but the stored proc is not displaying there also...Please help me ASAP..

Thanks
dotnetdev1

View 4 Replies View Related

Mind-boggling Gridview Results! Different Results For Different Teams..

Jun 18, 2008

Hi all, I have the following SQLDataSource statement which connects to my Gridview:<asp:SqlDataSource ID="SqlDataSourceStandings" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"  SelectCommand="SELECT P.firstName, P.lastName, T.teamName, IsNull(P.gamesPlayed, 0) as gamesPlayed, IsNull(P.plateAppearances,0) as plateAppearances, IsNull( (P.plateAppearances - (P.sacrifices + P.walks)) ,0) as atbats, IsNull(P.hits,0) as hits, P.hits/(CONVERT(Decimal(5,2), IsNull(NullIF(P.atbats, 0), 1))) AS [average], (P.hits + P.walks)/(CONVERT(Decimal(5,2), IsNull(NullIF( (P.atbats + P.sacrifices + P.walks) , 0), 1)))  AS [OBP], (P.hits - (P.doubles + P.triples + P.homeRuns) + (2 * P.doubles) + (3 * P.triples) + (4 * P.homeRuns)) / (CONVERT(Decimal(5,2), IsNull(NullIF(P.atbats, 0), 1))) AS [SLG], P.singles, P.doubles, P.triples, P.homeRuns, P.walks, P.sacrifices, P.runs, P.rbis FROM Players P INNER JOIN Teams T ON P.team = T.teamID ORDER BY P.firstName, P.lastName"></asp:SqlDataSource>There are 8 teams in the database, and somehow the average and obp results are as expected for all teams except where T.teamID = 1.  This doesn't make sense to me at all!  For example, I get the following results with this same query: First NameLast NameTeamGPPAABHAVGOBPSLG1B2B3BHRBBSACRRBI

BrianAustinHope83432230.7187500.7352941.15625014612201221

GabrielHelbigSafe Haven62119141.0000000.9375002.1428576404111519

MarkusJavorSafe Haven82927200.8695650.8000001.21739114501021218

RobBennettMelville83029240.8275860.8333331.55172411904102117

AdamBiesenthalSafe Haven82929210.9130430.9130431.56521712631001015

ErikGalvezMelville82625180.7200000.7307691.24000011322101015 As you can see, all teams except for Safe Haven's have the correct AVG and OBP.  Since AVG is simply H/AB, it doesn't make sense for Gabriel Helbig's results to be 1.00000. Can anyone shed ANY light on this please?Thank you in advance,Markuu  ***As a side note, could anyone also let me know how I could format the output so that AVG and OBP are only 3 decimal places? (ex: 0.719 for the 1st result)*** 

View 2 Replies View Related

Removing Individual Results From A Paged Set Of Results.

Oct 19, 2007

Hi,
I have a web form that lets users search for people in my database they wish to contact. The database returns a paged set of results using a CTE, Top X, and Row_number().
I would like to give my users to option of removing individual people from this list but cannot find a way to do this.
I have tried creating a session variable with a comma delimited list of ID's that I pass to my sproc and use in a NOT IN() statement. But I keep getting a "Input string was not in a correct format." Error Message.
Is there any way to do this? I am still new to stored procedures so any advice would be helpful.
Thanks
 

View 3 Replies View Related

PASTE SQL RESULTS INTO EXCEL - Funny Results

Jan 30, 2008

Hi, when I copy and paste results from query analyzer into Excel it appears that values with zeroes at the end loose the zeroes. Example, if I copy and paste V128.0 into an Excel cell it comes out as V128 or if I copy 178.70 it displays as 178.7 - any ideas? I'm using SQL Enterprise Manager for 2000.

View 6 Replies View Related







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