Get A Value From A Record Using SelectParameters

Feb 10, 2008

Hi there!
Basicly I only want to retrieve the value of the field "FirstTime" from a record as shown below:
1
2 Dim ProdUserID As String = "samurai"
3
4 Dim LoginSource As New SqlDataSource()
5
6 LoginSource.ConnectionString = ConfigurationManager.ConnectionStrings("ASPNETDBConnectionString1").ToString()
7
8 LoginSource.SelectCommandType = SqlDataSourceCommandType.Text
9 LoginSource.SelectCommand = "SELECT FROM aspnet_Users (FirstTime) VALUES (@FirstTime) WHERE UserName=@ProdUserID"
10
11 Dim SeExiste As Boolean = LoginSource.SelectParameters.GetValues("@FirstTime")
12

 This is the error reported:

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: BC30455: Argument not specified for parameter 'control' of 'Public Function GetValues(context As System.Web.HttpContext, control As System.Web.UI.Control) As System.Collections.Specialized.IOrderedDictionary'. 
 Please can you answer in the same logical schema? I'm a newbie so if you may, describe the process step by step. It would be easier for me to understand.

Thanks in advance. 
 

View 1 Replies


ADVERTISEMENT

What Am I Forgetting In SelectParameters?

Mar 10, 2008

What am I forgetting to do?  I am setting the SELECT parameter 'techcode' in the code behind trying to paqss it as the ZWOP in my SQL Select statement but it is not getting to the SQl SelectParameters statement.  Do I need to place a TextBox control on the ASPX page to hold it?
ERROR: Exception Details: System.InvalidOperationException: Could not find control 'techcode' in ControlParameter 'ZWOP'.
CODE BEHINDint techcode;protected void Page_Load(object sender, EventArgs e){    techcode = 11;    }
ASPX CODE. . . SelectCommand="SELECT [ZL_ID], [complete], [error], [Zip], [ZipCity], [ZipState], [ZWOP] FROM ZipData WHERE ([complete] = 0 OR [complete] IS NULL ) AND [ZWOP] = @techcode ORDER BY Zip" <SelectParameters> <asp:ControlParameter ControlID="techcode" Name="ZWOP" PropertyName="SelectedValue" Type="Int16" /> </SelectParameters>

View 8 Replies View Related

SelectParameters - If Checked Add Where

Apr 3, 2008

What im looking to do is put a checkbox on my page and if the box is checked have it add a where clause to the sql statement.
The most i have seen with selectparameters is for it to basically take the value of the given control (or whatever) and dump it in to a query.
In this case what i would like to do is if the box is not checked it has my basic query run Select * from Table
and if the box is checked i would like it to run Select * from table where status='completed'
basically a check box that shows only completed items.
wasnt sure if i could do this with just the sqldatasource control and some selectparameters or if i had to write some code.
 Thanks
Justin

View 5 Replies View Related

SQL Datasource And SelectParameters ALL Items

Oct 24, 2006

Hi , I am trying to write a report generator by simply using a form and then a gridview that query's the database based on what the user selects on the form.  Anyways, I update the SQL parameters similar to below code.  I just want to know how i can tell the parameter to get ALL values from the parameter instead of a specific value. For example if the user wanted to see ALL the records for CustomerName what would i set the parameter default value to?  I tried the asterisk but that did not work.  Please guide me....Thanks!  MattSqlDataSource1.SelectParameters["CustomerName"].DefaultValue = "some value";<asp:SqlDataSource ... >   <SelectParameters>      <asp:Parameter Name="CustomerName" />   </SelectParameters></asp:SqlDataSource>

View 1 Replies View Related

How To Setup SelectParameters Programmatically?

Feb 16, 2007

Hi,
I am using Visual Web Developer 2005 Express Edition.
I am trying to SELECT three information fields from a table when the Page_Load take place (so I select the info on the fly). The refering page, sends the spesific record id as "Articleid", that looks typically like this: "http://localhost:1424/BelaBela/accom_Contents.aspx?Articleid=2". I need to extract the "Article=2" so that I can access record 2 (in this example).
How do I define the SelectParameters or QueryStingField on the fly so that I can define the WHERE part of my query (see code below). If I remove the WHERE portion, then it works, but it seem to return the very last record in the database, and if I include it, then I get an error "Must declare the scalar variable @resortid". How do I programatically set it up so that @resortid contains the value that is associated with "Articleid"?
My code is below.
Thank you for your advise!
RegardsJan/*******************************************************************************
* RETRIEVE INFORMATION FROM DATABASE
*******************************************************************************/
// specify the data source
string connContStr = ConfigurationManager.ConnectionStrings["tourism_connect1"].ConnectionString;
SqlConnection myConn = new SqlConnection(connContStr);

// define the command query
String query = "SELECT resortid, TourismGrading, resortHits FROM Resorts WHERE ([resortid] = @resortid)";
SqlCommand myCommand = new SqlCommand(query, myConn);

// open the connection and instantiate a datareader
myConn.Open();
SqlDataReader myReader = myCommand.ExecuteReader();

// loop thru the reader
while (myReader.Read())
{
Label5.Text = myReader.GetInt32(0).ToString();
Label6.Text = myReader.GetInt32(1).ToString();
Label7.Text = myReader.GetInt32(2).ToString();
}

// close the reader and the connection
myReader.Close();
myConn.Close(); 

View 3 Replies View Related

How To Specify 2 Different Selectparameters - 1 For Querystringparameter And 1 For Controlparameter

Apr 4, 2007

Hello,
I am sure there is a way to do this programmatically, but it is just not sinking in yet on how to go about this.  I have a page where I use a dropdownlist that goes into a gridview and then the selected item of the gridview into the detailsview (typical explain seen online).  So, when selecting from the dropdownlist, the gridview uses a controlparameter for the selectparameter to display the appropriate data in the gridview (and so on for the detailslist). 
My question is - I wanted to use this same page when coming in from a different page that would utilize querystring.  So, the parameter in the querystring would be for what to filter on in the gridview, so the dropdownlist (and that associated controlparameter) should be ignored.
Any suggestions on how to go about this?  I assume there is some check of some sort I should in the code (like if querystring is present, use this querystringparameter, else use the controlparameter), but I am not sure exactly what I should check for and how to set up these parameters programmatically.
 Thanks,
Jennifer

View 5 Replies View Related

SqlDataSource.SelectParameters Method

Apr 27, 2008

Hi,
 I am using a grid view with parameter defined in dropdown list. the asp code is:
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:Pubs %>"
SelectCommand="SELECT [au_id], [au_lname], [au_fname], [state] FROM [authors] WHERE ([state] = @state)"
DeleteCommand="DELETE FROM [authors] WHERE [au_id] = @au_id">
<SelectParameters>
<asp:ControlParameter ControlID="DropDownList1" Name="state" PropertyName="SelectedValue"
Type="String" /></SelectParameters>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:Pubs %>"
SelectCommand="SELECT [au_id], [au_lname], [au_fname], [state] FROM [authors] WHERE ([state] = @state)"
DeleteCommand="DELETE FROM [authors] WHERE [au_id] = @au_id">
<SelectParameters>
<asp:ControlParameter ControlID="DropDownList1" Name="state" PropertyName="SelectedValue"
Type="String" />
</SelectParameters>
</asp:SqlDataSource>
</asp:SqlDataSource>
 I would like to to set the parameter assignment in my VB code in Page_Load methodWhen i am using:
SqlDataSource1.SelectParameters("state").DefaultValue = DropDownList1.Text
SqlDataSource1.SelectCommand = "SELECT [au_id], [au_lname], [au_fname], [state] FROM [authors] WHERE ([state] = @state)"I get error message saying: Object reference not set to an instance of an object.
Any ideas how I can set the select parameters (in my VB code) to use the dropdown list I have in my page?
Thanks,
 Uzi

View 8 Replies View Related

Setting The SelectParameters Of SqlDataSource

Dec 30, 2005

Hi All,
I'm trying to set the SelectParameters of SqlDataSource from the code behind.
This is my query: SELECT * FROM [UploadSessions] WHERE ([OwnerID] = @OwnerID)And I need to set the value of the @OwnerID at the code behind since it is stored in an object.
How can I do it??
Thanks in advance
Bar
 

View 7 Replies View Related

Problem Using SelectParameters With Oracle Queries

Oct 24, 2006

Hi,I have a GridView which is bound to a SqlDataSource that connects to Oracle. Here's the code: <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:OracleConnectionString %>"
ProviderName="<%$ ConnectionStrings:OracleConnectionString.ProviderName %>" SelectCommand="SELECT QUIZ.TITLE FROM QUIZ WHERE (QUIZ.USERNAME = @UserName)"> <SelectParameters> <asp:SessionParameter Name="UserName" SessionField="currentUser" Type="String" /> </SelectParameters> </asp:SqlDataSource> As you can see I'm trying to pass the value of the "currentUser" session variable to the query. I get an error message "ORA-xxx Illegal name/variable". Where am I going wrong? I tested the connection by placing a specific value instead of the "@UserName" and it worked. 

View 1 Replies View Related

&<SelectParameters&> && Checked Items From CheckBoxList

Nov 24, 2006

Column1 in table 1 has a range from 1 to 5 (int)
A CheckboxList displays these 5 items. When checked (for example 1 and 4) I want a gridview with sqldatasource=sqlProducts to display the records where column1 values 1 or 4.
When I use the code below I only get the records where column1 values 1.... 
<asp:SQLDataSource id="sqlProducts" Runat="Server" SelectCommand="Select * From Table1 where Column1 IN (@CBLchecked_items)" ConnectionString="<%$ ConnectionStrings:pubs %>">            <SelectParameters>                            <asp:ControlParameter Name="CBLchecked_items" ControlID="CBL" propertyname="SelectedValue" type="String" />            </SelectParameters></asp:SQLDataSource>
 
 

View 2 Replies View Related

Retuen 1 Fild On SqlDataSource1.SelectParameters

Feb 28, 2007

 
 
ALTER PROCEDURE dbo.Default_Edit1
(
@ID int,
@Family Nvarchar (100) OutPut
)
AS
/* SET NOCOUNT ON */
SELECT @Family=Family FROM Table1 where (ID=@ID)
 
 
RETURN
 
 
SqlDataSource1.SelectParameters.Add("ID", Me.GridView1.DataKeys(CInt(e.CommandArgument)).Item(0))
SqlDataSource1.DeleteCommandType = SqlDataSourceCommandType.StoredProcedure
SqlDataSource1.SelectCommand = "dbo.Default_Edit1"
SqlDataSource1.SelectParameters("Family").Direction = Data.ParameterDirection.Output
Label3.Text = SqlDataSource1.SelectParameters("Family").Direction.ToString()
 
it's have error 
I went to return 1 fild
 ??
 
 

View 2 Replies View Related

How To Set SessionParameter And QueryStringParameter Both In SelectParameters Of SQLDataSource.

Mar 14, 2008

<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:CollegeDatabaseConnectionString %>"                 SelectCommand="SELECT employee_datails.* FROM employee_datails WHERE memberid !=@id OR memberid OR memberid==uid">        <SelectParameters>                 <asp:SessionParameter Name="id" SessionField="userid" />                <asp:QueryStringParameter Name="uid" QueryStringField="memberid" />       </SelectParameters>    </asp:SqlDataSource> I tried like this but it is not working. It takes at a time one sessionparameter or querystringparameter. I want if profile.aspx--> then i want session parameter in select queryIf profile.aspx?id=12432---> then i want  querystringparameter in select query.

View 2 Replies View Related

How To Pass A Null To SelectParameters In SqlDataSource?

Feb 17, 2006

How to pass a null to SelectParameters in SqlDataSource?
The type of "CreateDate" is DateTime, the following code can be run correctly!
SqlDataSource1.SelectParameters["CreateDate"].ConvertEmptyStringToNull = true;SqlDataSource1.SelectParameters["CreateDate"].DefaultValue = "2006-11-12";
now I hope to pass null value to the Parameter "CreateDate", but the following 3 section codes don't work!
SqlDataSource1.SelectParameters["CreateDate"].ConvertEmptyStringToNull = true;SqlDataSource1.SelectParameters["CreateDate"].DefaultValue = string.Empty;
or
SqlDataSource1.SelectParameters["CreateDate"].ConvertEmptyStringToNull = true;SqlDataSource1.SelectParameters["CreateDate"].DefaultValue =null;
or
SqlDataSource1.SelectParameters["CreateDate"].ConvertEmptyStringToNull = true;SqlDataSource1.SelectParameters["CreateDate"].DefaultValue = "";

View 4 Replies View Related

How To Retuen Data With SqlDataSource1.SelectParameters At StoredProcedure

Mar 2, 2007

I Have This StoredProcedure
ALTER PROCEDURE dbo.Default_Edit1
( @ID int, @Family Nvarchar (100) OutPut
)
AS
SELECT @Family=Family FROM Table1 where (ID=@ID)
RETURN
 I went to use  SqlDataSource1.SelectParameters to Return Data
Ho to get and set @ID , @Family with  SelectParameters  ?
 
 
 
 

View 3 Replies View Related

Sqldatsource:SelectParameters:FormParameter Not Effective Till Postback?

Nov 14, 2007

I have a simple gridview that loads on page load. It uses an on page sqldatasource declaration in which there's a parameter in which value is already available in cookies. I added an asp:HiddenField and set that value on PageLoad() to the value of the cookies. I then set a FormParameter in the sqldatasource mapped to that hidden field. However that appears to have no effect at all. I'm guessing the sqldatasource will only use the form field after postback.

View 2 Replies View Related

Programatically Adding Selectparameters Depending On Options Selected

Jan 14, 2008

Hi everyone,
I am building a search page and am a bit stuck.
The page has an sqldatasource with no select command and i am passing the select command and parameters depending on the optionsm selected.
If a tick box is ticked and a drop down selected i need to add a parameter to the datasource and generate the select command.
then if 1 and or 2 trext boxes are filled in, add the 1 or 2 select parameters then generate the select command.
The select command is correct as far as i can tell , but the parameters are not being passed to the datasource so it doesn't select anything.
my code behind is in the page load handler and at the moment only adds the parameters in one place so i could test. 
Does anyone have any idea what i have done wrong?
 
Cheers
Chris
CODE BEHINDProtected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim SQLstr As String
 

If cb_Today.Checked = True And dd_Area.SelectedValue.ToString <> "" ThenLocManSearch.SelectParameters.Add("Area", TypeCode.String, dd_Area.SelectedValue.ToString())
SQLstr = "SELECT * FROM [LocMan_CV] WHERE ([area] LIKE '%" & dd_Area.SelectedValue.ToString() & "%') AND ([available] LIKE '%" & Date.Today & "%') AND ([viewable] = 'True')"
ElseIf cb_Today.Checked = False And dd_Area.SelectedValue.ToString <> "" Then
SQLstr = "SELECT * FROM [LocMan_CV] WHERE ([area] LIKE '%" & dd_Area.SelectedValue.ToString() & "%') "
ElseIf txt_FName.Text <> "" And txt_LName.Text <> "" And cb_Today.Checked = False And dd_Area.SelectedValue.ToString = "" Then
SQLstr = "SELECT * FROM [LocMan_CV] WHERE ([FirstName] LIKE '%" & txt_FName.Text.ToString() & "%') and [LastName] LIKE '%" & txt_LName.Text.ToString() & "%')"
ElseIf txt_LName.Text <> "" And cb_Today.Checked = False And dd_Area.SelectedValue.ToString = "" Then
SQLstr = "SELECT * FROM [LocMan_CV] WHERE ([LastName] LIKE '%" & txt_LName.Text.ToString() & "%')"
ElseIf txt_FName.Text <> "" And cb_Today.Checked = False And dd_Area.SelectedValue.ToString = "" Then
SQLstr = "SELECT * FROM [LocMan_CV] WHERE ([FirstName] LIKE '%" & txt_FName.Text.ToString() & "%')"
End If
Response.Write(SQLstr)
LocManSearch.SelectCommand = SQLstr
End Sub
 
SQL DATA SOURCE
 
<asp:SqlDataSource ID="LocManSearch" runat="server" ConnectionString="<%$ ConnectionStrings:MYLOCDEVConnectionString %>" >
<SelectParameters></SelectParameters>
</asp:SqlDataSource>

View 4 Replies View Related

Hi! 1st Time, Can't Program &<SelectParameters&> And Searching Around Brings No Definite Answer

Mar 22, 2008

Hello to all coding members!
I'm building my first ever complete website in the ASP.net VB language and I have to say, I'm pretty happy that I was able to learn from this website and to gain some ground.
Data retrieval and editing from tables and databases was very intuitive with the Visual Web Developer IDE. I even learnt simple ways to implement (and to script a bit of) login pages to make my visitors feel "at home" in my website.However, when I wanted to implement simple Business Logic into one of my ASP.net page, i happen to stumble upon a block.Business Logic: To have the server go through the whole table of storybook entries submitted by many users, but only pull out the storybook entry(s) that belong to the logged-on user.Hence, let me drill down to my specific questions:


I will be using VB. Coming from a JavaScript genre, my concern is: will putting the Business Logic code into a code-behind page (.vb) or dumping it onto the page itself have any errors or effects?

View 8 Replies View Related

SqlDataSource.SelectParameters Causing Procedure Or Function Stored Procedure Has Too Many Arguments Specified.

Sep 12, 2006

 Hi everybody,   I am having trouble how to fixed this code. I am trying to supply the parameterinside a stored procedure with a value, and displays error message shown below. If I did not supply the parameter with a value, it works. How to fix this?Error Message:Procedure or function <stored proc name> has too many arguments specified.Thanks,den2005 
Stored procedure:

Alter PROCEDURE [dbo].[sp_GetIdeaByCategory]
@CatId <span class="kwd">int</span> = 0
AS
BEGIN
SET NOCOUNT ON;

Select I.*, C.*, U.* From Idea I inner join IdeaCategory C on I.CategoryID = C.IdeaCategoryID inner join Users U on I.UserID = U.UserID Where I.CategoryID = @CatId Order By LastModifiedDate Desc
End


oDataSource.ConnectionString = constr;
oDataSource.SelectCommand = storedProc;<span class="cmt">//storedproc - sp_GetIdeaByCategory</span>
oDataSource.SelectCommandType = SqlDataSourceCommandType.StoredProcedure;
oDataSource.SelectParameters.Add(<span class="st">&quot;@CatId&quot;</span>, catId);
gdvCategories.DataSourceID = oDataSource.ID;

gdvCategories.DataBind(); &lt;&lt;--- Error occured here


 

View 1 Replies View Related

TOUGH INSERT: Copy Sale Record/Line Items For Duplicate Record

Jul 20, 2005

I have a client who needs to copy an existing sale. The problem isthe Sale is made up of three tables: Sale, SaleEquipment, SaleParts.Each sale can have multiple pieces of equipment with correspondingparts, or parts without equipment. My problem in copying is when I goto copy the parts, how do I get the NEW sale equipment ids updatedcorrectly on their corresponding parts?I can provide more information if necessary.Thank you!!Maria

View 6 Replies View Related

How To Create An Copy Of A Certain Record Except One Specific Column That Must Be Different &&amp; Insert The New Record In The Table

Sep 1, 2006

Hi
I have a table with a user column and other columns. User column id the primary key.

I want to create a copy of the record where the user="user1" and insert that copy in the same table in a new created record. But I want the new record to have a value of "user2" in the user column instead of "user1" since it's a primary key

Thanks.

View 6 Replies View Related

Ways To Make This Work: Several Selectable Related Record For One Main Record.

Apr 6, 2007

Hey all!



Sorry for the less then descriptive post title but I didn't find a better way to describe it. I'm developing an app in the express editions of VB and SQLserver. The application is a task/resource scheduler. The main form will have a datepicker or weekly overview and show all tasks scheduled per day. The problem is, I've got one or more people assigned to tasks and I wonder what's the best way to design this. Personally, I'd go for one Task table, a People table and a table that provides a link between them (several record per task, one for each person assigned linking TaskID and PplID). However, I don't see a nice way of showing this data to the end user, allowing him to edit/add etc on ONE screen.

To fix that the only way I see is just add columns to the Task table for every person with select boxes. This way everything can be done on one simple screen. This obviously does present some future issues.

On top of this, which people are available on a day varies and there should be an option to allow a user to set who is available on a specific day. Which would lead me to my first idea and add another table that would provide this. but then I'm having design issues again for the form.



I'm kinda stuck atm, can anyone shed some light on this. I'm sure there is an elegant way of doing this but I'm failing at finding it.



Thanks in advance,

Johan

View 5 Replies View Related

Query Timeouts When Updating A Record Retrieved Through A Websphere JDBC Datasource - Possible Record Locking Problem

Apr 7, 2008

Hi,

We're running a Sage CRM install with a SQL Server 2000 database at the back end. We're using the Sage web services API for updating data and a JDBC connection to retrieve data as it's so much quicker.

If I retrieve a record using the JDBC connection and then try and update the same record through the web services, the query times out as if the record is locked for updates. Has anyone experienced anything similar or know what I'm doing wrong? If I just use DriverManager.getConnection() to establish the connection instead of the datasource, and then continue with the same code I don't get these record locking problems. Please find more details below.

Thanks,
Sarah

The JDBC provider for the datasource is a WebSphere embedded ConnectJDBC for SQL Server DataSource, using an implementation type of 'connection pool datasource'. We are using a container managed J2C authentication alias for logging on.

This is running on a Websphere Application Server v6.1.

Code snippet - getting the record thru JDBC:


DataSource wsDataSource = serviceLocator.getDataSource("jdbc/dsSQLServer");
Connection wsCon = wsDataSource.getConnection();


// wsCon.setAutoCommit(false); //have tried with and without this flag - same results

Statements stmt = wsCon.createStatement();


String sql = "SELECT * FROM Person where personID = 12345";
ResultSet rs = stmt.executeQuery(sql);


if(rs.next()){
System.out.println(rs.getString("lastName"));
}

if (rs != null){
rs.close();
}
if (stmt != null) {

stmt.close();
}
if (wsCon != null) {

wsCon.close();
}

View 1 Replies View Related

SSIS: Multi-Record File Extract With 9 Record Types

Feb 26, 2008

I am attempting to create a multi-record file (as described in my last thread) and have found the following set of instructions very helpful:
http://vsteamsystemcentral.com/cs21/blogs/steve_fibich/archive/2007/09/25/multi-record-formated-flat-file-with-ssis.aspx

I have been able to create a sample file with two of my record types.

I now need to build on this further, because I have 9 record types in total that need to be extracted to a single flat file.

does anyone have any ideas how I might extend the example above to include more record types or know of another means of achieving this?

Thanks in advance for any help you might be able to provide.


View 3 Replies View Related

Add Date To Record In SQL Server Each Time Record Is Added

Mar 1, 2006

Hi
 
Can anyone advise me as to how I can add the date and time to 2 columns in the sql server database for each record that is added. I'd prefer not to use the webform. Can sql server add the date automatically to the row?
thanks

View 6 Replies View Related

Restrict Inserting Record If Record Already Exist In Table

Apr 17, 2014

Is that possible to restrict inserting the record if record already exist in the table.

Scenario: query should be

We are inserting a bulk information of data, it should not insert the row if it already exist in the table. excluding that it should insert the other rows.

View 2 Replies View Related

Delete Record Based On Existence Of Another Record In Same Table?

Jul 20, 2005

Hi All,I have a table in SQL Server 2000 that contains several million memberids. Some of these member ids are duplicated in the table, and eachrecord is tagged with a 1 or a 2 in [recsrc] to indicate where theycame from.I want to remove all member ids records from the table that have arecsrc of 1 where the same member id also exists in the table with arecsrc of 2.So, if the member id has a recsrc of 1, and no other record exists inthe table with the same member id and a recsrc of 2, I want it leftuntouched.So, in a theortetical dataset of member id and recsrc:0001, 10002, 20001, 20003, 10004, 2I am looking to only delete the first record, because it has a recsrcof 1 and there is another record in the table with the same member idand a recsrc of 2.I'd very much appreciate it if someone could help me achieve this!Much warmth,Murray

View 3 Replies View Related

Switch Record Background Color With Each Record In Report

Jan 14, 2008

Hi Everyone-

i have a matrix report
and i want to switch the record background color with each record in the value column in that matrix report
e.g 1st record background color is gray and next record background color is white
and then the next record background color is gray ... and so on

can anyone help?

thanx
Maylo

View 8 Replies View Related

Joining Record With The Most Recent Record On Second Table

Apr 23, 2008

Could anybody help me with the following scenario:

Table 1 Table2

ID,Date1 ID, Date2

I would like to link the two tables and receive all records from table2 joined on ID and the record from table1 that has the most recent date.

Example:

Table1 data Table2 Data

ID Date1 ID Date2
31 1/1/2008 31 1/5/2008
34 1/4/3008 31 4/1/2008
31 3/2/2008


The first record in table2 would only link to the first record in table1
The second record in table2 would only link to the third record in table1

Any help would be greatly appreciated.
Thanks

View 4 Replies View Related

How To Return First Record Child Record And Count

Jan 31, 2006

I've been looking for examples online to write a SPROC to get some data. Here are the tables.

Album_Category
AlbumCategoryID (PK, int, not null)
Caption (nvarchar(max), not null)
IsPublic (bit, not null)

Albums
AlbumID (PK, int, not null)
AlbumCategoryID (int, null)
Caption (nvarchar(max), not null)
IsPublic (bit, not null)

I need to return:
-[Album_Category].[AlbumCategoryID]
-[Album_Category].[Caption]
-[Albums].[Single AlubmID for each AlbumCategoryID]
-[Count of Albums in each AlbumCategory]

I hope I was fairly clear in what I'm trying to do. Any tips or help would be appreciated. Thanks.

View 3 Replies View Related

SQL Challenge - How To Return A Record Set Starting At A Particular Record?

Feb 25, 2007

I have a directory of user information. What I would like to do isallow someone to search for person X and then return not only theinformation for person X, but also the information for the next 15people following person X sorted alphabetically by lastname.So if someone searched for the lastname = "Samson", it would return:Samson, JohnSaxton, GregScott, HeatherSears, Rebecca.... (15 names following "Samson) ...How do you in SQL return a record set of X records starting atparticular record (e.g. lastname = "Smith)?Thanks in advance.

View 4 Replies View Related

Column Locked In Record Even Though No One Accessing Record

Mar 18, 2008



Hello. I have a database with a record that has two columns locked. descrip1 and descrip2. they are both nvarchar(max) columns. These are the only two columns of the record that remain locked. I am certain no user is accessing the record. I have even moved a backup of the database to my testing computer and the lock still exists. How do I remove the lock from these two columns on that particular record.

I can edit these two columns on other records. I have researched "Unlock" on MSDN but it doesn't seem to apply to t-sql. Any help would be greatly appreciated.

Thanks. Gary.

View 4 Replies View Related

Update A Record Based Of A Record In The Same Table

Aug 16, 2006

I am trying to update a record in a table based off of criteria of another record in the table.

So suppose I have 2 records

ID owner type

1 5678 past due

2 5678 late

So, I want to update the type field to "collections" only if the previous record for the same record is "past due". Any ideas?

View 5 Replies View Related

Keep Track Of When And By Who A Record Was Created And Also When And By Who The Record Was Last Updated

May 26, 2008

I have not yet succeeded in getting an aswer to this in a previous post, so I'll try again and rephrase the question

I have 2 fields, 1 called 'Created' the other 'Updated'

I would like to create a function, user procedure ,whatever in SQL something along the lines of...

FUNCTION myUID()
RETURN Date(Today)+Time(Now)+USERNAME
END FUNCTION


so that the value returned by the above pseudo code is something like '20080526T21:01:05.620SamL' where the date part is in yyyy0m0d format

I have got this working fine for the default 'Created' field but the calculated (and persisted) field comes up with something about being non-deterministic and refuses to play

Clearly something along these lines is a very straightforward requirement (I have it working fine in my 20+ year old database) , but have spent a week trying to get an answer (even from this forum) without success, so would be grateful for any help that you can provide me with to get round this barrier

View 10 Replies View Related







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