DataSource Controls :: Looking For Explanation Of Query ?

Feb 21, 2010

Hregarding to following query:

Use AdventureWorks

Go
ELECT p.ProductID,
piy.ProductID

What does mean ON 1 = 1 in this query??

View 3 Replies


Similar Messages:

DataSource Controls :: SqlDataSource And Parameters Query / Trying To Accomplish Is Building Dynamic Query

Aug 22, 2010

1. I have a GridView on my page and it uses sqldatasource with parameterized query. What I want to do is, on page load (where nothing has been selected so no parameter supplied), I want it to query everything (something like SELECT * FROM [this_table]) but since my SelectCommand is something like

SELECT * FROM [this_table] WHERE [this_column] = @someParameters AND [that_column] = @someParameters.

Can I play around with default value to achieve something like that but how ? Now, when the page loads, it doesn't show anything (No Gridview).

2. On my page, I made something like (username, gender, address, and more) and one single search button. That means, no single control enable auto postback. What I am trying to accomplish is building dynamic query

(if username specifed -> SELECT * FROM [this_table] WHERE [username] LIKE @username).

If both username and gender are specified (SELECT * FROM [this_table] WHERE [username] LIKE @username AND [gender] = @gender) and you know the rest. How can I do this using GridView and SqlDataSource ? To my knowledge, I can only specify one SELECT statement in a sqldatasource.

View 11 Replies

DataSource Controls :: Update Query Not Working When Using Query Builder To Configure Table Adapter

Jan 15, 2010

[code]...

This query works perfectly on the query analyser.

But when configuring the Table adapter ,I try executing the query and i get 0 rows affected.

What could I be getting wrong in this case.

NB:Existing GalleryID has been supplied.

View 1 Replies

DataSource Controls :: Can't Find Query's / By Right Clicking On Database Created A Query In Server Explorer?

May 17, 2010

By right clicking on my database i created a query in server explorer. But where are this query stored can't find them back. I should aspect that their is a folder query's like there is a folder tables but this isn't the case.

View 10 Replies

DataSource Controls :: How To Convert Sql Query Into Linq Query

Mar 10, 2010

select Groupid,GroupName,onorusername from palgroup where groupid in (select distinct Groupid

View 5 Replies

DataSource Controls :: Accessing FK From A Query Via Entity Query

Jan 21, 2010

I've got a query such as

Dim MediaQuery =
From m
In dB.DOWNLOADS _Where m.ID = id _Select

which returns a record from the database. One of the fields in the record is a FK to another table. I need to read this value to be able to set a dropdown based on the ID but I can't work out how to access it. For a standard record I can just do the following txtTitle.Text = MediaQuery.FirstOrDefault().TITLE

However with the foreign key it doesn't work like that. I've tried drpGroup.SelectedIndex = MediaQuery.FirstOrDefault().DOWNLOAD_GROUPS.ID where DOWNLOAD_GROUPS is the FK field but it returns Object reference not set to an instance of an object. If you're simply wanting to read some values from a single db record in the entitiy framework and one is a foreign key how should I go about getting the value?

View 2 Replies

DataSource Controls :: Not Able To Run SQL Query Using If Else?

Apr 21, 2010

I am using Querystring "ddl4" to pass on value of a drop down list to the next page where I am using that value in the WHERE clause of a SQL command. I also need to check whether ddl4 is blank or not which I do using If Else in SQL command. I am not able to run the query where the Querystring ddl4 IS NULL

This is the sample link with the Querystring ddl4 carrying a blank value:

[code]....

View 2 Replies

DataSource Controls :: How To Run Sql Query From Project

Apr 13, 2010

I have one query in my project (saved in folder SQLQueryes, Query.sql) and i need to execute it. Also, i have one parameter in script and i need to include him also. How?

View 8 Replies

DataSource Controls :: SQL Query With IF And Select

Feb 18, 2010

SQL Query with IF and Select

View 2 Replies

DataSource Controls :: Why We Need Union Query

Jun 10, 2010

if there is no relation bettwenn two tables why do i need union for example like below Please
can u inform me

SELECT categoryId
FROM categories
UNION
SELECT shipperId
FROM shippers

View 3 Replies

DataSource Controls :: Query Using Linq To Sql?

Jun 25, 2010

I´m using Linq to Sql in my asp.net application, but the problem is:I have a query like this:

[Code]....

My query is not returning anything, how do I do to get this?my problem is with this interval I need to have.

View 2 Replies

DataSource Controls :: Can't Use Query Effectively - First Name And Last Name

May 13, 2010

i want to know that should first name and last should be kept as sperate field or merged into single attribute. The Basic problem i am facing to keep first name and last name in seperate fields is that i cannot effectively use like query for searching a record by name

View 7 Replies

DataSource Controls :: Xml.query In Sql And No Records?

Mar 15, 2010

I have table in database with xml field and data like below

[Code]....

there are no records found

View 1 Replies

DataSource Controls :: Use A Parentheses In An SQL Query?

May 26, 2010

How do I use a Parentheses in an SQL query, example:

SET [myrow] = 'New Value' WHERE [myrow] = 'my (old) value'

View 2 Replies

DataSource Controls :: Use Login Name In A SQL Query?

Nov 24, 2010

I'm creating a web project in ASP.NET (C#) using Visual Studio 2010. I'm using the built-in login page. Here is what I'm trying to achieve.I want when a user logs in, the default.aspx page will display all his information including firstname, lastname, email address... I created a database table to store all users information (SQL). I want to use the "login name" as a parameter in "SELECT * FROM usertable WHERE username = loginname". From the code-behind (default.aspx.cs) I can pull the current loginname with "this.User.Identity.Name" but I can't pass this information to the query command in the default.aspx page.For example, when Jim logs in with his user name as "sirjim", I want to use"sirjim" in place of "loginname" in default.aspx page.Code in default.aspx page:

<asp:GridView
ID="GridView1"
runat="server"

[code]...

View 3 Replies

DataSource Controls :: Get Sum In Single Query?

Jan 4, 2010

I have 2 tables table1 and table2 as given below.

Table1 - user master table. table2 - transaction table. Now I want to write a single query which will give results like table 3. how to write single query.

TABLE 1
TABLE 2
TABLE 3
USER ID

[Code]....

View 13 Replies

DataSource Controls :: SQL Query Formation?

Jun 11, 2010

I have several dropdowns in ASP.net, I want the contents in each dropdown depending on what is selected from the above dropdown and the datasource queries reflect this. I have the queries correct for the first two dropdowns, but I cannot get the third displaying data.

The first dropdown just contains all dept names

The second dropdown contains the manager names in that chosen dept above

The third is meant to contain the list employees relating to the chosen manager name above

<asp:Label ID="Label1" runat="server" Text="Cost Centre:" Font-Bold="True"></asp:Label>
<br />
<asp:DropDownList ID="DropDownList_CostCentres" runat="server" Height="21px"[code]....

View 1 Replies

DataSource Controls :: SQL Query Migration?

Mar 30, 2010

I am having some trouble querying a SQL Express DB from my ASP.NET 3.5 application. I am new to ASP.NET 3.5, only having used ASP in the past.In ASP, my code would be:

Dim db
Set db = Server.CreateObject("ADODB.connection")
'Opens the db connection string stored in another asp webform [code]....

This code creates the connection to the database, assigns the variable SQLi with the query, and assigns the execute command for that query to the variable RSi.

In ASP.NET, I have managed to get this far:

'The connection string is stored in web.config [code].....

I am unsure how to do the next part, when the individual id is assigned to the variable GEN1i (the syntax .fields does not appear to work for me).

View 6 Replies

DataSource Controls :: One Linq Query With Two Db Connection?

May 31, 2010

I want to use from two db connection in one linq query

My sample is:

int a=1;
if(a==1)
DataClasses1DataContext1 db = new DataClasses1DataContext1();
else
DataClasses1DataContext2 db = new DataClasses1DataContext2();
var q =
from c
in db.F_Groups
select c;

In this code a=1 so db connection is DataClasses1DataContext1

I want if a=2 then db connection = DataClasses1DataContext2

but this code is error.

db connections is completely same but in two deferent class a db connection is sql and another is oracle

View 4 Replies

DataSource Controls :: Query String Add Another DropdownList?

Mar 6, 2010

Trying to add another 2nd dropdownlist to Query String... Below This Query String works Perfectly:

Query = String.Format("SELECT {0} FROM {1} WHERE NACategory = '{2}' ORDER BY {3}", PrimaryKeyColumn, TableName, DDLCategory.SelectedItem.Text, SetSorting())
I've tried to add a 2nd DDLSubCategory.SelectedItem.Text - But its throwing and error message.
Exception of type System.StackOverflowException was thrown.
Query = String.Format("SELECT {0} FROM {1} WHERE NACategory = '{2}' AND NASubCategory = '{3}' ORDER BY {4}", PrimaryKeyColumn, TableName, DDLCategory.SelectedItem.Text,
DDLSubCategory.SelectedItem.Text, SetSorting())
Can Someone take a look I'm not sure how to write (add) 2nd DropdownList (DDLSubCategory.SelectedItem.Text)

View 6 Replies

DataSource Controls :: How To Convert Sql Query To LINQ

Feb 13, 2010

How can I convert this sql query to LINQ ?

[code]...

View 1 Replies

DataSource Controls :: Sql Select Query Where Date

Apr 13, 2010

in DataBase Attendancedate is save in this format 4/5/2010 4:16:28 PM ..i want to query like this select * from EmployeeAttendance where Attendancedate='4/5/2010' but this giv error

View 5 Replies

DataSource Controls :: How To Know If A Single Row Query Fails

Jan 15, 2010

I am using a 'SingleOrDefault' LINQ query with a Lambda expression such as:

Email email = db.Emails.SingleOrDefault(p => p.Email1 == Textbox1.Text);

If the textbox entry does not match anything stored in the table, how would I know and how could I deal with this situation in the code?

View 12 Replies

DataSource Controls :: Appending Some Variable To SQL Query?

Jan 21, 2010

I want query like this

declare @stateQuery as nvarchar(200)
if @stateid is null
set @stateQuery=''
if @stateid is not null
set @stateQuery='and tbl_city.stateid ='+cast(@stateid as nvarchar(10))
set @length=(select top 1 len(dbo.Tbl_city.cityName) FROM dbo.tbl_city INNER JOIN tbl_cityinfonew ON dbo.tbl_city.cityId = tbl_cityinfonew.cityId where (tbl_cityinfonew.language =@language )+cast( @stateQuery as nvarchar(100)) order by tbl_cityinfonew.createdate desc)

I don't want to use the exec @string.

View 6 Replies

DataSource Controls :: Embed Variable Within SQL Query?

May 5, 2010

I am using a data list to display some value retrieved from a SQL query. My problem is that I would like to insert a variable for the field of ISDS_454.dbo.booksusers.userID. The variable has already been declared and stored upon page load. I just need some way to get it within the SQL query for the datalist.

<script runat="server"> Sub Page_Load()
Dim ID As String = "D07AD7E0-8E34-4C18-9B4D-10576B0CC6BF" End Sub
</script> <asp:DataList ID="DataList1" runat="server" DataSourceID="SqlDataSource1">
<ItemTemplate> fic: <asp:Label ID="ficLabel" runat="server" Text='<%# Eval("fic") %>' />
<br /> <br /> </ItemTemplate> </asp:DataList> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ISDS_454ConnectionString %>" SelectCommand="Select COUNT(*) as fic
From ISDS_454.dbo.Books, ISDS_454.dbo.booksusers, ISDS_454.dbo.Genre
where ISDS_454.dbo.Books.ISBN = ISDS_454.dbo.booksusers.ISBN
And ISDS_454.dbo.Genre.Genre_ID = '1'
And ISDS_454.dbo.booksusers.userID = 'D07AD7E0-8E34-4C18-9B4D-10576B0CC6BF'">
</asp:SqlDataSource>

View 6 Replies







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