Something Not Right With This Query From Msdn
Sep 20, 2006
I have been trying to straighten out the select statement(underlined) in the procedure below but no luck. It is at the link below:(User-Specific Paging from ASP.NET)
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag/html/scalenethowto05.asp
I think the "author" messed up during the copy and paste. Someone please help out. I really need its correct version. Thanks.
blumonde
// The BindData method constructs a SQL query that uses nested SELECT TOP
// statements (as described earlier) to retrieve a specified page of data.
//
public void BindData()
{
SqlConnection myConnection = new SqlConnection(_connStr);
String strCmd = "";
StringBuilder sb = new StringBuilder();
sb.Append("select top {0} CustomerID,CompanyName,ContactName,ContactTitle from (select top {1} CustomerID,CompanyName,ContactName,ContactTitle from Customers ");
sb.Append("as t1 order by contactname desc) ");
sb.Append("as t2 order by contactname asc");
strCmd = sb.ToString();
sb = null;
// Set pseudoparameters: TableName, KeyField and RowIndex
strCmd = String.Format(strCmd, _pageSize, _currentPageNumber * _pageSize);
// Prepare the command
SqlCommand myCommand = new SqlCommand(strCmd,myConnection);
SqlDataAdapter sa = new SqlDataAdapter(myCommand);
DataSet searchData = new DataSet("SearchData");
try
{
myConnection.Open();
sa.Fill(searchData);
MyDataGrid.DataSource = searchData;
MyDataGrid.DataBind();
}
finally
{
myConnection.Close();
}
CurrentPage.Text = _currentPageNumber.ToString();
if ( !Page.IsPostBack )
{
using (SqlConnection conn = new SqlConnection(_connStr))
{
SqlCommand cmd = conn.CreateCommand();
cmd.CommandText = "SELECT Count(*) FROM Customers";
conn.Open();
_totalRecords = (int)cmd.ExecuteScalar();
_totalPages = _totalRecords / MyDataGrid.PageSize;
TotalPages.Text = _totalPages.ToString();
}
}
else
{
_totalPages = int.Parse ( TotalPages.Text );
}
if (_currentPageNumber == 1)
{
PreviousPage.Enabled = false;
if (_totalPages > 1)
NextPage.Enabled = true;
else
NextPage.Enabled = false;
}
else
{
PreviousPage.Enabled = true;
if (_currentPageNumber == _totalPages)
NextPage.Enabled = false;
else
NextPage.Enabled = true;
}
}
View 32 Replies
ADVERTISEMENT
Mar 22, 1999
Hi
I have installed the MSDN SQL 7.0 final release on 2 Win NT (1 server and 1 Wkst)
When I launch DTS, I CAN export/import ACCESS <--> SQL and vice versa
I CANNOT export/import SQL7 <--> SQL7
I have this error messsage :
"The licence for installation of Microsoft SQL Server
on your source and destination connections does not permit the use
of DTS to transform data. refer to your licence agreement for more
information"
any ideas why ? Is there any limitation with MSDN CD ?
View 1 Replies
View Related
Aug 31, 2007
Hello,
I recently got me a new laptop with Vista preinstalled. All good and well, but when I try to install a program vital for my profession, I get an error (OS not supported for this program). In the install I can configure what components to install, one of them is MSDN 2000. My question is, will SQL Server Express take over what MSDN can't on Vista (and thus running the program needing the MSDN 2000), or will windows XP be the new OS on my brand new laptop in the future. Love Vista, hate the compatibility.
View 1 Replies
View Related
Mar 14, 2008
Where is the list for forums,
When i started to write for Sqlserver, i never searched or looked for forum. Same did when i was working with the c#.
Now I have to find the correct forum. So where is the list of those forums, thanks.
View 3 Replies
View Related
Jun 6, 2007
Why are there 2 RS forums on MSDN
This is the other one
http://msdn.microsoft.com/newsgroups/default.aspx?dg=microsoft.public.sqlserver.reportingsvcs
This one has a worse UI
View 2 Replies
View Related
Oct 16, 2006
Hello,
Using VS 2005 SP1 beta and SQL Server 2005.
I am trying to learn how SQL CLR works by using this example:
http://msdn2.microsoft.com/en-us/library/5czye81z.aspx
When I press F5, I get this error:
A .NET Framework error occurred during execution of user defined routine or aggregate 'InsertCurrency':
System.Data.SqlClient.SqlException: Must declare the scalar variable "@CurrencyCode".
Do I need to declare @CurrencyCode in the Test.sql script?
Thanks for any suggestions,
Tom
View 7 Replies
View Related
Feb 2, 2007
Are there any limits to the number of user that can connect or anything like that with SQL 2000 (MSDN Vs)?
Thanks!
View 1 Replies
View Related
Sep 26, 2007
the msdn article explains how to input new data to a databse and return the primary key of the inputted row. It works perfectly. However, it explains how to insert a value, but there is a problem. It seems to set the value to be submitted in the VB code, instead of having the value be the user's input in the textbox. Look for the following line in the code below: newRow("ClientFileNumber") = "ClientFileNumber" It inputs "clientfilenumber" instead of what is actually inputted in the texbox. Does anyone know how to bypass this, to not have the words "clientfilenumber" inputted?Dim sqlconn As SqlConnection = New SqlConnection("Data Source=.SQLEXPRESS;AttachDbFilename=|DataDirectory|Client.mdf;Integrated Security=True;User Instance=True")
Dim catDA As SqlDataAdapter = New SqlDataAdapter("SELECT * FROM Orders", sqlconn)
catDA.InsertCommand = New SqlCommand("JobInsert", sqlconn)
catDA.InsertCommand.CommandType = CommandType.StoredProcedure
catDA.InsertCommand.Parameters.Add("@ClientFileNumber", SqlDbType.VarChar, 50, "ClientFileNumber")Dim NewJobNumber As SqlParameter = catDA.InsertCommand.Parameters.Add("@Identity", SqlDbType.Int, 0, "OrdersID")
NewJobNumber.Direction = ParameterDirection.Output
sqlconn.Open()
Dim catDS As DataSet = New DataSetcatDA.Fill(catDS, "Orders")
Dim newRow As DataRow = catDS.Tables("Orders").NewRow()
newRow("ClientFileNumber") = ""catDS.Tables("Orders").Rows.Add(newRow)
catDA.Update(catDS, "Orders")
sqlconn.Close()
Response.Redirect("control_page_copy.aspx?NewJobNumber=" + NewJobNumber.Value.ToString())
View 1 Replies
View Related
Jul 20, 2005
I was hoping I can get some help regarding subject mater located athttp://msdn.microsoft.com/library/d...des_02_92k3.aspMyTable has 23 fields with 100,000 records.Field1 nvarchar 90Field2 char 6Field3 varchar 8000Field4 nvarchar 200Field5 nvarchar 200Field6 nvarchar 200Field7 nvarchar 200Field8 nvarchar 200Field9 char 30Field10 char 30Field11 nvarchar 200Field12 nvarchar 200Field13 float 8Field14 datetime 8Field15 datetime 8Field16 datetime 8Field17 nvarchar 200Field18 nvarchar 200Field19 varchar 8000Field20 nvarchar 200Field21 nvarchar 200Field22 nvarchar 200Field23 varchar 8000Data Types:nvarchar = Variable-length, Storage is 2 times the # of characters enteredchar = Fixed-length. Storage is n bytesvarchar = Variable-length, Storage is actual length in bytes of data enteredfloat = Is float Fixed-length?, my precisions are 15 digits so 8 bytes.datetime = Is datetime Fixed-length?, Storage is 8 bytesI need the following blanks filled in for me, please :-)Num_Rows 100,000Num_Cols 23Fixed_Data_SizeNum_Variable_Cols 16Max_Var_SizeNull_Bitmap Int(2 + ((23 + 7) / 8)) = 5?Variable_Data_SizeRow_SizeRows_Per_PageFree_Rows_Per_Page 100 (no clustered index created)Num_PagesTable Size
View 2 Replies
View Related
Jan 18, 2007
If we purchase a new MSDN Professional subscription, does it come with SQL Server 2000 developer license?
View 3 Replies
View Related
May 19, 2008
Hi all,
An internal licensing review is being carried out at my site for the first time since I joined. I have been asked to confirm that development SQL Server instances have been installed from MSDN installation disks and production instances from non-MSDN disks. I understand that serverproperty('licensetype') will show me this information in SQL Server 2000, and I am (perhaps incorrectly?) assuming that a result of "DISABLED" means MSDN was used for the installation.
In SQL Server 2005, i believe the installation does not record the necessary information in the registry, meaning serverproperty('licensetype') is of no use.
Is the question i've been asked impossible to answer? Is there any way I can find out if MSDN disks (or network copies of them) were used to install a SQL Server 2005 instance?
Many thanks.
James
View 4 Replies
View Related
Aug 16, 2007
We use MSDN SQL 2000 , the enterprise edition for our development servers,
which have always had 2GB RAM.
Now they are bringing in a Win 2003 Enterprise with > 12GB RAM .
They want SQL SERVER 2000 to use AWE memory up to 12GB . Is there any limitation
on MSDN Ent. Edition using more memory.?
View 2 Replies
View Related
Dec 26, 2006
Hi
Is this an upgrade for sql server 2005 express.
If I already have Sql server 2005 express must I still download
the whole file.
Rgds
Rob
View 2 Replies
View Related
Sep 18, 2007
Hi,
I have seen many examples at MSDN library related to SQL Querries in all queries one thing is same the way they use tables in there queries. BUT wht is this really i am not getting this, can anyone tell me.. the code and the problem is as follows:
Code Snippet
FROM Purchasing.ProductVendor JOIN Purchasing.Vendor
ON (ProductVendor.VendorID = Vendor.VendorID)In the above code u see "Purchasing.ProductVendor", I want to ask that wht is this
Purchasing Stands for, If we suppose that purxchasing is the database name then also
normally we use database name as Purchasing.dbo.ProductVendor BUT I am not getting that
what is this,
Please if someone knows then explain it to me,
Thanks.
View 2 Replies
View Related
Jul 10, 2004
First off - complete newbie using MSDN.
Getting the error message
System.Data.SqlClient.SqlException: SELECT permission denied on object 'mytable', database 'master', owner 'dbo'. at System.Data.SqlClient.SqlCommand.ExecuteReader...
1. After a lot of googling I've done the following:
EXEC sp_grantlogin 'MYMACHINEASPNET' to grant the ASPNET logon access to the DB
2. Changed the
HKEY_LOCAL_MACHINESOFTWAREMicrosoftMSSQLServerMSSQLServerLoginMode
to 2 to allow mixed mode.
3. using my connection string in web.config - have experimented with different strings with/without trusted_connection and the sa uname and pwd.
(Current connection string is
"server=localhost;Integrated Security=SSPI;Database=master;Data Source=MYCOMPUTERNAME;trusted_Connection=yes"
I'm NOT using SQL Server so what commands do i need to give my db/table SELECT permissions? (and who am I giving permission to - very confused)
I had no bother accessing the server and DB from a simple C# command line program.
Been pulling my hair out for many hours now... any help would be greatly appreciated!
View 1 Replies
View Related
Jul 10, 2004
(Not having a great day - didn't mean to lock that last post - apologies)
First off - complete newbie using MSDN.
Getting the error message
System.Data.SqlClient.SqlException: SELECT permission denied on object 'mytable', database 'master', owner 'dbo'. at System.Data.SqlClient.SqlCommand.ExecuteReader...
1. After a lot of googling I've done the following:
EXEC sp_grantlogin 'MYMACHINEASPNET' to grant the ASPNET logon access to the DB
2. Changed the
HKEY_LOCAL_MACHINESOFTWAREMicrosoftMSSQLServerMSSQLServerLoginMode
to 2 to allow mixed mode.
3. using my connection string in web.config - have experimented with different strings with/without trusted_connection and the sa uname and pwd.
(Current connection string is
"server=localhost;Integrated Security=SSPI;Database=master;Data Source=MYCOMPUTERNAME;trusted_Connection=yes"
I'm NOT using SQL Server so what commands do i need to give my db/table SELECT permissions? (and who am I giving permission to - very confused)
I had no bother accessing the server and DB from a simple C# command line program.
Been pulling my hair out for many hours now... any help would be greatly appreciated!
View 5 Replies
View Related
Nov 3, 2005
Hi,How can I tell If my sql server is MSDN or Standard or Enterpriseversion.Thank youAR
View 5 Replies
View Related
Mar 30, 2007
Check out the new Books Online search functionality online. The link below provides a scoped search of Books Online that returns a more precise and targeted result set. You can use it to search Books Online content quickly.
http://search.live.com/macros/sql_server_user_education/booksonline
Please direct your feedback to SQLServerUE@hotmail.com.
View 3 Replies
View Related
Apr 28, 2008
I don't know why I can not see 'sign in' button on msdn forums now at my company's computer. I can see that button several days ago, but now I can not see it. Why? I only can see post but can not create a new one or reply.
At home computer everything is fine.
Thanks.
View 2 Replies
View Related
Oct 27, 2006
I am new to SSIS 2005
http://msdn2.microsoft.com/en-us/library/ms167106.aspx
SSIS 2005 MSDN Tutorial - Lesson 1 - subsection namely 'Adding and Configuring the Lookup Transformations ' - in that STEP 7 not working. Not able to select the 'columns' tab.
Anybody worked-out this Lesson1 with the step provided by MSDN.
Pls help. Thanks
View 3 Replies
View Related
Oct 18, 2007
I'm trying to use the MSDN subscriber downloads VPC image for SQL Server 2008 CTP4. There are 4 files listed as 1 of 4, 2 of 4, ... 4 of 4.
When executing the WinRAR self-extracting archive, it runs normally for a while and starts to create a .VHD file but just when it seems to be almost complete, it stops and asks for "c:mypathen_sql_server_2008_ctp_4_vhd_part_1_of_5_.rar".
Since the files were just posted back on 10/9, I thought I would wait and eventually, someone would notice the problem and post corrected files but now it's been over a week and I don't see new files or any mention of any problems.
Is anyone else able to successfully download and extract this image?
LaRoux
View 3 Replies
View Related
Jun 18, 2007
As I am begininng to believe that is the only edition I am going to be able to run on my Vista Utlimate os.
Standard does not install server components.
I believe SQL Express was working as installed with Visual Studio 2005, but I need the use the tools that SQL Express does not contain.
Thanks,
_Greg
View 3 Replies
View Related
May 5, 2006
Problem 1 > Manual uninstalltion of Beta VS MSDN 2005 .
Throwing error ...
Unable to install (Internal fault occured)
Problem 2 > Uninstallation using Microsoft uninstller of Beta (VS, SQL etc)
Throwing error ...
"MS SQL Server 2005 Ex CTP
The set up ha sencountered an error in datsource Error in installds
XMLrw error : failure looking xmlrw.dll. check procedure () return 2"
View 1 Replies
View Related
Aug 18, 2005
I installed Sql 2005 on a Win2003, Sp1 platform. Some problems but nothing too big. Next I attempted to install VS 2005 (June) CTP. The install faled and here's the error log:
View 1 Replies
View Related
Dec 28, 2005
The SQL SERver 2005 Standard Edidtion install CD and the MSDN CD distributedat the SQLServer Launch in Chicago are blank. Has anyone else had thisproblem and or requested replacements? If so, how.thanks muchMo
View 1 Replies
View Related
May 14, 2007
if I have the following code:
using Microsoft.SqlServer.Dts.Runtime;
using Microsoft.SqlServer.Dts.Tasks.SendMailTask;
class TestSendMailTask
{
public static void Main()
{
Package pkg = new Package();
ConnectionManager smtpCM;
smtpCM = pkg.Connections.Add("SMTP");
smtpCM.Name = "SMTP Connection Manager";
smtpCM.ConnectionString = "smtphost";
Executable exe = pkg.Executables.Add("STOCKendMailTask");
TaskHost thSendMailTask = (TaskHost)exe;
{
thSendMailTask.Properties["SmtpConnection"].SetValue(thSendMailTask, "SMTP Connection Manager");
thSendMailTask.Properties["ToLine"].SetValue(thSendMailTask, "someone1@example.com");
thSendMailTask.Properties["CCLine"].SetValue(thSendMailTask, "someone2@example.com");
thSendMailTask.Properties["BCCLine"].SetValue(thSendMailTask, "someone3@example.com");
thSendMailTask.Properties["FromLine"].SetValue(thSendMailTask, "someone4@example.com");
thSendMailTask.Properties["Priority"].SetValue(thSendMailTask, MailPriority.Normal);
thSendMailTask.Properties["FileAttachments"].SetValue(thSendMailTask, "C:\test_image.jpg");
thSendMailTask.Properties["Subject"].SetValue(thSendMailTask, "Testing the SendMail Task");
thSendMailTask.Properties["MessageSourceType"].SetValue(thSendMailTask, SendMailMessageSourceType.DirectInput);
thSendMailTask.Properties["MessageSource"].SetValue(thSendMailTask, "This is only a test.");
}
DTSExecResult valResults = pkg.Validate(pkg.Connections, pkg.Variables, null, null);
if (valResults == DTSExecResult.Success)
{
pkg.Execute();
}
}
}
-------
How do I make it a workable package so it compiles , w/ javadoc style comments and instructions, so, other people can use it?
View 20 Replies
View Related
Dec 19, 2003
I'm running a query, actually its an insert that works when using the TSQL below.
However when I try to use the debugger to step through and using the exact same values as those below I get the following error:
[Microsoft][ODBC SQL Server Driver]Invalid character value for cast specification
Its Killing me because everything else works, but this. Can somebody help.
DECLARE @NoteID INT,-- NULL OUTPUT,
@Note_Description NVARCHAR(3000),-- = NULL,
@Date DateTime,-- = NULL OUTPUT,
@ByWho NVARCHAR(30),-- = NULL,
@FK_Action_Performed NVARCHAR(40),-- = NULL,
@FK_UserID INT,-- = NULL,
@FK_JobID INT,-- = NULL,
@Job_Date DateTime,-- = NULL,
@Start DateTime,-- = NULL,
@Finish DateTime,-- = NULL,
@BeenRead NVARCHAR(10),-- = NULL
@FK_UserIDList NVARCHAR(4000)-- = NULL
--SET @NoteID = 409 --NULL OUTPUT,
SET @Note_Description = 'Tetsing'
--SET @Date DateTime = NULL OUTPUT,
SET @ByWho = 'GeorgeAgaian'
SET @FK_Action_Performed = 'Worked hard'
SET @FK_UserID = 5
SET @FK_JobID = 29
SET @Job_Date = 28/01/03
SET @Start = '1:00:20 PM'
SET @Finish = '1:00:20 PM'
SET @BeenRead = 'UnRead'
SET @FK_UserIDList = '1,2,3'
--AS
--SET NOCOUNT ON
SET NOCOUNT ON
SET XACT_ABORT ON
BEGIN TRANSACTION
SET @Date = GETDATE()
-- Insert Values into the customer table
INSERT Note (Note_Description,
Date,
ByWho,
FK_Action_Performed,
FK_UserID,
FK_JobID,
Job_Date,
Start,
Finish)
SELECT --@NoteID,
@Note_Description,
@Date,
@ByWho,
@FK_Action_Performed,
@FK_UserID,
@FK_JobID,
@Job_Date,
@Start,
@Finish
-- Get the new Customer Identifier, return as OUTPUT param
SELECT @NoteID = @@IDENTITY
-- Insert new notes for all the users that the note pertains to, in this case this will be by the assigned
-- users.
IF @FK_UserIDList IS NOT NULL
EXECUTE spInsertNotesByAssignedUsers @NoteID, @FK_UserIDList
-- Insert New Address record
-- Retrieve Address reference into @AddressId
-- EXEC spInsertForUserNote
-- @FK_UserID,
--@NoteID,
-- @BeenRead
-- @Fax,
-- @PKId,
-- @AddressId OUTPUT
COMMIT TRANSACTION
--------------------------------------------------
GO
View 1 Replies
View Related
May 28, 2008
ok can someone tell me why i get two different answers for the same query. (looking for last day of month for a given date)
SELECT DATEADD(ms, - 3, DATEADD(mm, DATEDIFF(m, 0, CAST('12/20/2006' AS datetime)) + 1, 0)) AS Expr1
FROM testsupplierSCNCR
I am getting the result of 01/01/2007
but in query analizer I get the result of
12/31/2006
Why the different dates
View 4 Replies
View Related
Jan 22, 2001
Hi,
I get this error dialog when I try to open all the rows of any table from Enterprise manager..
Any help would be really appreciated..
Thanks,
-Srini.
View 1 Replies
View Related
May 24, 2007
SQL Server 2005 9.0.3161 on Win 2k3 R2
I receive the following error:
"Error: 8624, Severity: 16, State: 1 Internal Query Processor Error: The query processor could not produce a query plan. For more information, contact Customer Support Services."
I have traced this to an insert statement that executes as part of a stored procedure.
INSERT INTO ledger (journal__id, account__id,account_recv_info__id,amount)
VALUES (@journal_id, @acct_id, @acct_recv_id, @amount)
There is also an auto-increment column called id. There are FK contraints on all of the columns ending in "__id". I have found that if I remove the contraint on account__id the procedure will execute without error. None of the other constraints seem to make a difference. Of course I don't want to remove this key because it is important to the database integrity and should not be causing problems, but apparently it confuses the optimizer.
Also, the strange thing is that I can get the procedure to execute without error when I run it directly through management studio, but I receive the error when executing from .NET code or anything using ODBC (Access).
View 5 Replies
View Related
Mar 28, 2007
Hey, i've written a query to search a database dependant on variables chosen by user etc etc. Opened up a new sqldatasource, entered the query shown below and went on to the test query page. Entered some test variables, everything works as it should do. Try to get it to show in a datagrid on a webpage - nothing. No data shows.
SELECT dbo.DERIVATIVES.DERIVATIVE_ID, count(*) AS Matches
FROM dbo.MAKES INNER JOIN
dbo.MODELS ON dbo.MAKES.MAKE_ID = dbo.MODELS.MAKE_ID INNER JOIN
dbo.DERIVATIVES ON dbo.MODELS.MODEL_ID = dbo.DERIVATIVES.MODEL_ID INNER JOIN
dbo.[VALUES] ON dbo.DERIVATIVES.DERIVATIVE_ID = dbo.[VALUES].DERIVATIVE_ID INNER JOIN
dbo.ATTRIBUTES ON dbo.[VALUES].ATTRIBUTE_ID = dbo.ATTRIBUTES.ATTRIBUTE_ID
WHERE ((ATTRIBUTES.ATTRIBUTE_ID = @ATT_ID1 and (@VAL1 is null or VALUE = @VAL1)) or
(ATTRIBUTES.ATTRIBUTE_ID = @ATT_ID2 and (@VAL2 is null or VALUE = @VAL2)) or
(ATTRIBUTES.ATTRIBUTE_ID = @ATT_ID3 and (@VAL3 is null or VALUE = @VAL3)) or
(ATTRIBUTES.ATTRIBUTE_ID = @ATT_ID4 and (@VAL4 is null or VALUE = @VAL4)) )
GROUP BY dbo.DERIVATIVES.DERIVATIVE_ID
HAVING count(*) >= CASE WHEN @VAL1 IS NOT NULL THEN 1 ELSE 0 END +
CASE WHEN @VAL2 IS NOT NULL THEN 1 ELSE 0 END +
CASE WHEN @VAL3 IS NOT NULL THEN 1 ELSE 0 END +
CASE WHEN @VAL4 IS NOT NULL THEN 1 ELSE 0 END -2
ORDER BY count(*) DESC
Here is the page source
<%@ Page Language="VB" MasterPageFile="~/MasterPage.master" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:DevConnectionString1 %>"
SelectCommand="	SELECT dbo.DERIVATIVES.DERIVATIVE_ID, count(*) AS Matches 	FROM dbo.MAKES INNER JOIN 				 dbo.MODELS ON dbo.MAKES.MAKE_ID = dbo.MODELS.MAKE_ID INNER JOIN 				 dbo.DERIVATIVES ON dbo.MODELS.MODEL_ID = dbo.DERIVATIVES.MODEL_ID INNER JOIN 				 dbo.[VALUES] ON dbo.DERIVATIVES.DERIVATIVE_ID = dbo.[VALUES].DERIVATIVE_ID INNER JOIN 				 dbo.ATTRIBUTES ON dbo.[VALUES].ATTRIBUTE_ID = dbo.ATTRIBUTES.ATTRIBUTE_ID 	WHERE ((ATTRIBUTES.ATTRIBUTE_ID = @ATT_ID1 and (@VAL1 is null or VALUE = @VAL1)) or 		 (ATTRIBUTES.ATTRIBUTE_ID = @ATT_ID2 and (@VAL2 is null or VALUE = @VAL2)) or 		 (ATTRIBUTES.ATTRIBUTE_ID = @ATT_ID3 and (@VAL3 is null or VALUE = @VAL3)) or 		 (ATTRIBUTES.ATTRIBUTE_ID = @ATT_ID4 and (@VAL4 is null or VALUE = @VAL4)) ) 	GROUP BY dbo.DERIVATIVES.DERIVATIVE_ID 	HAVING count(*) >= CASE WHEN @VAL1 IS NOT NULL THEN 1 ELSE 0 END + 									 CASE WHEN @VAL2 IS NOT NULL THEN 1 ELSE 0 END + 									 CASE WHEN @VAL3 IS NOT NULL THEN 1 ELSE 0 END + 									 CASE WHEN @VAL4 IS NOT NULL THEN 1 ELSE 0 END -2 	ORDER BY count(*) DESC ">
<SelectParameters>
<asp:ControlParameter ControlID="DropDownList1" Name="ATT_ID1" PropertyName="SelectedValue" />
<asp:ControlParameter ControlID="TextBox1" Name="VAL1" PropertyName="Text" />
<asp:Parameter Name="ATT_ID2" />
<asp:Parameter Name="VAL2" />
<asp:Parameter Name="ATT_ID3" />
<asp:Parameter Name="VAL3" />
<asp:Parameter Name="ATT_ID4" />
<asp:Parameter Name="VAL4" />
</SelectParameters>
</asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:DevConnectionString1 %>"
SelectCommand="SELECT * FROM [ATTRIBUTES]"></asp:SqlDataSource>
<br />
<asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="SqlDataSource2"
DataTextField="ATTRIBUTE_NAME" DataValueField="ATTRIBUTE_ID">
</asp:DropDownList>
<asp:TextBox ID="TextBox1" runat="server" AutoPostBack="True"></asp:TextBox><br />
<br />
<br />
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="DERIVATIVE_ID"
DataSourceID="SqlDataSource1">
<Columns>
<asp:BoundField DataField="DERIVATIVE_ID" HeaderText="DERIVATIVE_ID" InsertVisible="False"
ReadOnly="True" SortExpression="DERIVATIVE_ID" />
<asp:BoundField DataField="Matches" HeaderText="Matches" ReadOnly="True" SortExpression="Matches" />
</Columns>
</asp:GridView>
</asp:Content>
AFAIK I have configured the source to pick up the dropdownlist value and the textbox value (the text box is autopostback).
Am i not submitting the data correctly? (It worked with a simple query...just not with this one). I have tried a stored procedure which works when testing just not when its live on a webpage.
Please help!
(Visual Web Devleoper 2005 Express and SQL Server Management Studio Express)
View 4 Replies
View Related
Aug 5, 2014
I have the following code.
SELECT _bvSerialMasterFull.SerialNumber, _bvSerialMasterFull.SNStockLink, _bvSerialMasterFull.SNDateLMove, _bvSerialMasterFull.CurrentLoc,
_bvSerialMasterFull.CurrentAccLink, _bvSerialMasterFull.StockCode, _bvSerialMasterFull.CurrentAccount, _bvSerialMasterFull.CurrentLocationDesc,
_bvSerialNumbersFull.SNTxDate, _bvSerialNumbersFull.SNTxReference, _bvSerialNumbersFull.SNTrCodeID, _bvSerialNumbersFull.SNTransType,
_bvSerialNumbersFull.SNWarehouseID, _bvSerialNumbersFull.TransAccount, _bvSerialNumbersFull.TransTypeDesc,
[code]...
However, as you can see, the original select query is run twice and joined together.What I was hoping for is this to be done in the original query without the need to duplicate the original query.
View 2 Replies
View Related
Jun 15, 2007
I'm trying to find the command to open up an odbc conection inside sql2005 express. I only have ues of an odbc connector, we're conection to remedy. We will eventually be using stored procedures to extract the data we need from remedy and doing additional data crunching. I'm a foxpro programmer so once I get the correct syntax for making the odbc connector I shold be ok. Also I need a really good advanced book on sql2005. The type of book that would have my odbc answer. I've spent all morning trying to find this information and was unable to.
Thanks in advance
Daniel Buchanan.
If this was the wrong forum to post this on, please move this question to the correct one. I need this answer soon.
View 1 Replies
View Related