Returns a DataTable that describes the column metadata of the SqlCeDataReader
Problem
In its MSDN documentation, the Schema Table it returns dun contain "IsIdentity" column in comparison with SqlDataReader.GetSchemaTable Method.
But when I call SqlCeDataReader.GetSchemaTable in my program, it can return a schema table which contain "IsIdentity" column. However, its value is always False whatever the Data Table column is set to be Identity column. So I still can't know whether there is an identity or not.
How to solve it? Or there are any methods which help to decide it is an Identity column?
ResultSetProductos = ComandoCargaProductos.ExecuteResultSet(Data.SqlServerCe.ResultSetOptions.Scrollable Or Data.SqlServerCe.ResultSetOptions.Updatable)
End Sub
And I want to obtain the schema of the table which my resultset is pointing
Dim tabla As Data.DataTable
tabla = Me.ResultSetProductos.GetSchemaTable
But the datatable that i obtain donīt seem to have the schema that i need, for example donīt have the primary keys i have define and also donīt have any constrains......
I have a database that has a tble with a field that autoincrements as a primary key. meanig that the field type is BigInteger and it is set up as my Identity Column. Now when I insert a new record that field gets updated automaticly. How can I get this value in the same operation as my insert? meaning, in 1 sub, I insert a new record but then need to retieve the Identity Value. All in the same procedure. Waht is the way to achive this please? Marc
Hi, When i try to retirve the datatype of a variant column using SQLColAttribute, the datatype comes back as SQL_BINARY(-2) instead of a CHAR based type. To reproduce the problem, add extended property 'MS_Description' to either a column or a table. Assign a text value to the property.
Execute the following query and verify. SELECT value FROM sys.extended_properties WHERE name = 'MS_Description'
I'm using SQL Server 2005 sp 2 with Visual Studio 2005.
//get the datatype of the variant iReturn = SQLColAttribute( m_SQLStatement, (SQLUSMALLINT) 1, SQL_CA_SS_VARIANT_TYPE, NULL, NULL, &nDummyInt, &nType );
After the execution of SQLColAttribute, nType value is assigned a value of -2 (SQL_BINARY) instead of a CHAR based type. What am i doing wrong? Any help is appreciated.
As part of a web site I allow users to store documents in SQL Server 2000 using an Image column on a table. After the file is saved the user can open the document through the browser. This works great for most file extensions such as ".XLS" or ".DOC" but fails when attempting to open ".MSG" files (saved outlook messages). XLS documents will open in Excel and DOC documents open in Word, but MSG documents open in Notepad and display what appears to be binary data. I'm trying to figure out if this is a SQL Server issue or some sort of ASP/ASP.NET webserver issue.
If I attempt to open an MSG file stored directly on the web server, the file opens correctly using the "Microsoft Outlook View Control", but when attempting to open the same file saved in SQL Server, it attempts to open in notepad.
Not sure if this is the correct forum, but I 'm having problems retrieving a sqldatasource's asp:control parameter values from a selected row (during edit) in a gridview to update a record thru a stored procedure. The stored procedure is pretty intense, so I'd like to keep it in SQL if possible instead of creating the generic "update table set ..." that I see in most examples. It seems as if I can't get the propertyname right or something because it keeps giving me a "Procedure or function XX has too many arguments specified error". Maybe the DataKeyNames is not right?? I've tried just passing one parameter (ProductID-same as DataKeyNames) using "SelectedValue" as propertyname and still get the same. It's got to be something very simple, but I'm at a loss. All parameters are spelled the same in the sp (with an added "@" at start) as in the asp:controlparameters. Here's the gridview (asp.net 2.0 connecting to SQL Server 2005): <asp:GridView ID="gvLoadEditProductPrices" runat="server" AutoGenerateColumns="False" AllowSorting="True" DataSourceID="SqlDataSource1" DataKeyNames="ProductID"> <Columns> <asp:CommandField ShowEditButton="True" /> <asp:BoundField DataField="ProductID" HeaderText="ProductID" HeaderStyle-BackColor="white" InsertVisible="False" ReadOnly="True" SortExpression="ProductID" /> <asp:BoundField DataField="Product" HeaderText="Product" SortExpression="Product" ReadOnly="True" /> <asp:BoundField DataField="ProductCat" HeaderText="ProductCat" SortExpression="ProductCat" ReadOnly="True" /> <asp:BoundField DataField="VarRate" HeaderText="VarRate" SortExpression="VarRate" /> <asp:BoundField DataField="loadid" HeaderText="loadid" InsertVisible="False" ReadOnly="True" SortExpression="loadid" /> <asp:BoundField DataField="loadamount" HeaderText="loadamount" SortExpression="loadamount" ReadOnly="True" /> <asp:BoundField DataField="ProductCol" HeaderText="ProductCol" SortExpression="ProductCol" ReadOnly="True" /> <asp:BoundField DataField="PageID" HeaderText="PageID" SortExpression="PageID" ReadOnly="True" /> </Columns> </asp:GridView> and the sqldatasource's info: <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:MARSProductEditor %>" ProviderName="System.Data.SqlClient" SelectCommand="spGetLoadEditProductPrices" SelectCommandType="StoredProcedure" UpdateCommand="spUpdateProductPrices" UpdateCommandType="StoredProcedure" > <UpdateParameters> <asp:ControlParameter Name="ProductID" Type="Int32" ControlID="gvLoadEditProductPrices" PropertyName=SelectedDataKey.Values("ProductID")></asp:ControlParameter> <asp:ControlParameter Name="LoadID" Type="Int32" ControlID="gvLoadEditProductPrices" PropertyName=SelectedDataKey.Values("LoadID")></asp:ControlParameter> <asp:ControlParameter Name="PageID" Type="Int32" ControlID="gvLoadEditProductPrices" PropertyName=SelectedDataKey.Values("PageID")></asp:ControlParameter> <asp:ControlParameter Name="ProductCol" Type="Int32" ControlID="gvLoadEditProductPrices" PropertyName=SelectedDataKey.Values("ProductCol")></asp:ControlParameter> <asp:ControlParameter Name="NewRate" Type="Double" ControlID="gvLoadEditProductPrices" PropertyName=SelectedDataKey.Values("NewRate")></asp:ControlParameter> </UpdateParameters> <SelectParameters> <asp:ControlParameter ControlID="ddlEstLoadsPerAcre" Name="LoadID" PropertyName="SelectedValue" Type="Int32" /> <asp:ControlParameter ControlID="txtEditType" Name="PageName" PropertyName="Text" Type="String" /> </SelectParameters> </asp:SqlDataSource>
I am using following queries in a stored procedure.This stored procedure is executed through a dot net application.
DECLARE @DEPTNBR BIGINT SELECT @DEPTNBR = DEPTNBR FROM DEPARTMENT_DETAILS WITH (UPDLOCK,READPAST) WHERE STATUS= 1 UPDATE DEPARTMENT_DETAILS SET STATUS= 0 WHERE DEPTNBR = @DEPTNBR SELECT DEPTNBR,DEPTNAME,DEPTLOC FROM DEPARTMENT_DETAILS WHERE DEPTNBR = @DEPTNBR â
From my queries,I am providing a available department information.Each user needs to get unique available department information.But when more number of users using the application concurrently, multiple users getting same department information.How to solve my problem?I always wants to get unique department information even though multiple users using the application concurrently.
How can I efficiently retrieve the top x managers within the top y regions within the top z states within the top q countries? The only way I have been able to do this is to first find the top q countries, and store the list in an IN clause. Then for each of those, find the top z states and create another IN clause that contains the country+state concatenated. Then for each of those, find the top y regions and concatenate country+state+region. Then finally find the top x managers within this IN clause. This works fine for a few hundred records, but once it reaches the thousands, it takes much too long. The final IN clause contains thousands of entries. Isn't there a simpler way to approach this, especially with SQL Server 2005?
i am using a stored procedure, lets say spTemp, that calls sp_executesql within it. in the sp_executesql procedure i am passing parameters from the stored procedure 'spTemp'. i want to retrieve the result of the sp_executesql statement so as to perform further calculations in spTemp. is there a way of doing this?
ex:
create procedure spTemp ( @abc int ) as declare @temp int exec sp_executesql 'select @temp = Id from Product where @abc > 10' ...
I am now retrieving the PDF from the database and I am getting an error: Error 1 'GetImages.GetImage(int)': not all code paths return a value I have: int imageid = Convert.ToInt32(Request.QueryString["ACTUAL_IMAGE_PDF"]); And... private SqlDataReader GetImage(int imageid) { Sql Statement... } Could someone help please??
I have records in a table and 1 column is in the smalldatetime format which stores the date in the format "2004-09-22",2004-09-20",2004-09-12",2004-08-04" etc etc.
Can anyone tell me how to craft an SQL statement so that i can retrieve records for a certain month.For example,if i want to retrieve records for the month of September,i would get "2004-09-22",2004-09-20",2004-09-12" in results.
i have a table in MS SQL Server,i need to show two results at a time,and on click of a button nxt two results have to b shown,how do i accomplish this (i mean retrieving the results two at a time)thanx in advance
"I meant to delete just one assignment, doing which was giving me difficulty.
I deleted a whole category by accident which had most of my daily grades in it for a course with quite a few of them. I was negligent in backing them up, so I cannot restore them. I have an XLS file from the midterm, but am missing about 6 grades after that.
Is there any way to recover the grades I had in the deleted category. It has been a couple of days since I entered any new grades. HELP!"
My current backup strategy is to do a full backup 5 pm, differentials every 2 hours, logs every 30 min, all so they arenot simultaneous. Backing these all to same backup device via three different jobs.
Then the server is backed up to tape shortly after the 5 pm full backup.
Obviously, I can't restore from the backup for this situation because it would hurt other data.
But - is there a way I can take last night's backup from tape and restore it to a different database than our production database? (Such a database doesn't at this time exist. Would I detach, copy over the files, and then reattach on prod and attach on the devl side, and then restore from the backup device to the devl copy?)
I've never had to perform this kind of rescue and am wondering if my backup strategy is flawed since it isn't immediately evident how I can easily do this.
I needed a similar thing from our Oracle DBA yesterday, and he went to tape, copied out a table and put it on the Oracle database under a different owner, and I easily fixed the few records that I had botched.
That's exactly what I need to do now with MS SQL 2000.
I was hoping someone would be able to help me, I trying to go through several databases, 111 to be exact, and get the data out of a particular table which is present in all the databases on the same server.
I know how to get the names of the databases from the INFORMATION_SCHEMA, but how can use the name for it to cycle through all the databases and get data out of the one particular table.
I have a giant SQL query that retrieves a bunch of information from a couple of tables for use on a page, and I would like some help on constructing the SQL to get exactly what I have in mind. I have a table - called scContacts - that contains a list of contacts with detailed information. The contacts in the table are regular sales contacts, sales reps, and sales managers. Another table - called scCompany - contains a list of companies with detailed information.
For each company, we have a certain sales manager (or user) pertaining to that company as well as potentially a certain rep. The problem is that the contact tied to the company, the sales manager tied to the company, and the rep tied to the company all come from the same table. Here is the base SQL code I've used to get everything but the sales rep's name and sales manager's name:
scCompany.ID AS companyID, scCompany.companyName, scCompany.companyURL, scCompany.billToAddress1 AS companyAddress1, scCompany.billToAddress2 AS companyAddress2, scCompany.billToCity AS companyCity, scCompany.billToState AS companyState, scCompany.billToZip AS companyZip, scCompany.billToCounty AS companyCounty, scCompany.billToCountry AS companyCountry, scCompany.businessType, scCompany.phoneExt, scCompany.phoneNum, scCompany.faxNum, scCompany.minEmployees, scCompany.maxEmployees, scCompany.actionTypeMAX, scCompany.actionDateMAX, scCompany.actionTimeMAX, scCompany.statusID, scCompany.userID, scCompany.repID
FROM scCompany, scContacts
INNER JOIN scStatus ON scStatus.ID = scCompany.statusID
WHERE scgroupContacts.contactID = [insert cookie value] AND scgroups.ID = [insert cookie value] AND scCompany.ID = scContacts.companyID AND scCompany.groupID = scgroups.ID ----- END SQL CODE -----
As indicated right now, this SQL code will retrieve all of the contact and company information for a certain contact ID which comes from a cookie value (inserted in ASP). I want to get the [fName] and [lName] fields from scContacts table where the scContacts.ID = scCompany.userID, and I also want those same fields from scContacts table again where the scContacts.ID = scCompany.repID. It would be simplest and most efficient if I could do this all at once (and I'm sure it's possible). How would I change the SQL to bring in that information from the same table two more times, tying their ID's to ID's in the company table?
bobby writes "I have a Table from which i get the ID of customers(Customers are people who have written an online exam).The date of completion of the exams are stored in the corresponding table with the name of the exam.There are more than one exams and the names of the exams are stored in an other table.Now my question is how to get the date of cpletion with the given Id from the first table?"
Hi, I need some help. I have this query where i need to pull up students that have more than or equal to 3 absences in a row. Now I am getting all those students that are absent but not in a row. But i was wondering if there is a way to tell if a student was absent three days in a row . There is a date field that is being used to identify the day of the class and a status field that identifies if the student was absent or present. Please help someone.
i lost a table with lots of data - there's around 10,000 records inserted daily.
my problem was i only realized this morning (and i lost it last night) and i have the backups backing up each day every hour - so the backup had already overwritten it seems the db that was missing the table) my backup type is set to append - so i though i could retrieve by date time but it only let me retrieve the backup at 11pm(tune if last backup) and no earlier time. is there anyway of getting the data from the 7 pm backup -- again it backsup each hour to the same file - set to append so i thought that meant i could choose a time but it doesn't seem to be working.
insert into newTABLE(newCOLUMN) Select Case When [Column 11] like '%DOB%' Then SubString( [Column 11], CharIndex('DOB',[Column 11],1)+3, Case When CharIndex(';',[Column 11],1)= 0 Then CharIndex('.',[Column 11],1) Else CharIndex(';',[Column 11],1) End-(CharIndex('DOB',[Column 11],1)+3)) Else '' End,[column 11] from table
Following is da example of return result
through the image, we can found that some of them got ddmmyy and some got only year.Currently, i want to insert those record to newtable newcolumn with only those got propal date(unwanted for only year).What should i do following?
Hi AllBit of a situation so hopefully someone can advise.I've a client who has a sql 2000 database that *unfortunately* hasn'thad a backup procedure in place. Its been running for just over a yearand on Monday it got, well, screwed. They have a 50 gig ldf file.Yes, 50 gig. Is it possible to put in place a database maintenanceplan that will allow me to roll back to, say, last friday just from theldf file?Thoughts? Any advice would be welcome.MTIAMark
Hi all,I have an application that creates a publication on the server, andhave multiple mobile devices creating annonymous subscriptions to thatpublications. I need to write a report that checks if each device havethe replication synchronized successfully. I can rundistribution.dbo.sp_MSenum_merge or look intodistribution.dbo.MSmerge_history to get at the data for _all_subscriptions to a given publication, but to look at a particularsubscription, I need to filter by either the subscriber_db or agent_idcolumn. The problem is, how do I get either one of these informationfrom the device? Or is there other way of retrieving the merge historyfor a particular device/annonymous subscription?Thanks in advance,Harold
Hi,Is it possible to get metadata (i.e. descriptions of tables etc.) insql-server? In Oracle you can retrieve this information with tables likeall_objects, user_tables, user_views etc. For example, this query selectsthe owner of the table 'ret_ods_test' (in Oracle!):select ownerfrom all_objectswhere object_name = 'ret_ods_test'What's the equivalent in sql server?Thanks a lot.
Up to the moment I've got enough knowledge for read data stored into .LDF files by dbcc log and so on. It's very useful and interesting. Now, I wonder how to retrieve the same information but on MDF files.
At first, I want to make sure that is not possible by mean of traditional methods (dbcc or something like that) I suppose so but I'd like to hear opinions regarding that.
Thanks in advance for any idea, though or further information.
Hello and thanks for taking a moment. I am trying to retrieve and display an image that is stored in SQL Server 2000. My aspx code is as follows:<HTML> <HEAD> <title>photoitem</title> <meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1"> <meta name="CODE_LANGUAGE" Content="C#"> <meta name="vs_defaultClientScript" content="JavaScript"> <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5"> </HEAD> <body MS_POSITIONING="GridLayout"> <form id="Form1" method="post" runat="server"> <asp:DataGrid id="DataGrid3" HorizontalAlign='Left' runat="server" AutoGenerateColumns="true" Visible="True"> <Columns> <asp:TemplateColumn HeaderText="Image"> <ItemTemplate> <asp:Image Width="150" Height="125" ImageUrl='<%# FormatURL(DataBinder.Eval(Container.DataItem, "InventoryItemPhoto")) %>' Runat=server /> </ItemTemplate> </asp:TemplateColumn> </Columns> </asp:DataGrid> </form> </body></HTML>-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------My code behind file is below VS 2003 does not like my datareader. It says the following: 'System.Data.SqlClient.SqlDataReader' does not contain a definition for 'Items'If there are any suggestions as to what I am doing wrong I would appreciate the input. - Jasonusing System;using System.Collections;using System.ComponentModel;using System.Data;using System.Drawing;using System.Web;using System.Web.SessionState;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.HtmlControls;using System.Data.SqlClient;using System.Text;namespace ActionLinkAdHoc{ /// <summary> /// Summary description for photoitem. /// </summary> public class photoitem : System.Web.UI.Page { string connStr = System.Configuration.ConfigurationSettings.AppSettings["ConnectionString"]; protected System.Web.UI.WebControls.DataGrid DataGrid3; private void Page_Load(object sender, System.EventArgs e) { // Get the querystring ID string item =Request.QueryString["ID"]; int ID=Convert.ToInt32(item); SqlConnection dbConn5 = new SqlConnection(connStr); SqlCommand sqlCom5 =new SqlCommand("sp4TWRetrieveItemPhotos"); sqlCom5.Connection = dbConn5; sqlCom5.CommandType = CommandType.StoredProcedure; sqlCom5.Parameters.Add("@ID", SqlDbType.Int); sqlCom5.Parameters["@ID"].Value =ID; dbConn5.Open(); SqlDataReader myDataReader; myDataReader = sqlCom5.ExecuteReader(CommandBehavior.CloseConnection); DataGrid3.DataSource = sqlCom5.ExecuteReader(); DataGrid3.DataBind(); while(myDataReader.Read()) { Response.ContentType = myDataReader.Items("JPEG"); Response.BinaryWrite(myDataReader.Items("InventoryItemPhoto")); } dbConn5.Close(); } #region Web Form Designer generated code override protected void OnInit(EventArgs e) { // // CODEGEN: This call is required by the ASP.NET Web Form Designer. // InitializeComponent(); base.OnInit(e); } /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.Load += new System.EventHandler(this.Page_Load); } #endregion }}
Hello and thanks for taking a moment. I am trying to retrieve and display an image that is stored in SQL Server 2000. My aspx code is as follows:<HTML> <HEAD> <title>photoitem</title> <meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1"> <meta name="CODE_LANGUAGE" Content="C#"> <meta name="vs_defaultClientScript" content="JavaScript"> <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5"> </HEAD> <body MS_POSITIONING="GridLayout"> <form id="Form1" method="post" runat="server"> <asp:DataGrid id="DataGrid3" HorizontalAlign='Left' runat="server" AutoGenerateColumns="true" Visible="True"> <Columns> <asp:TemplateColumn HeaderText="Image"> <ItemTemplate> <asp:Image Width="150" Height="125" ImageUrl='<%# FormatURL(DataBinder.Eval(Container.DataItem, "InventoryItemPhoto")) %>' Runat=server /> </ItemTemplate> </asp:TemplateColumn> </Columns> </asp:DataGrid> </form> </body></HTML>-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------My code behind file is below VS 2003 does not like my datareader. It says the following: 'System.Data.SqlClient.SqlDataReader' does not contain a definition for 'Items'If there are any suggestions as to what I am doing wrong I would appreciate the input. - Jasonusing System;using System.Collections;using System.ComponentModel;using System.Data;using System.Drawing;using System.Web;using System.Web.SessionState;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.HtmlControls;using System.Data.SqlClient;using System.Text;namespace ActionLinkAdHoc{ /// <summary> /// Summary description for photoitem. /// </summary> public class photoitem : System.Web.UI.Page { string connStr = System.Configuration.ConfigurationSettings.AppSettings["ConnectionString"]; protected System.Web.UI.WebControls.DataGrid DataGrid3; private void Page_Load(object sender, System.EventArgs e) { // Get the querystring ID string item =Request.QueryString["ID"]; int ID=Convert.ToInt32(item); SqlConnection dbConn5 = new SqlConnection(connStr); SqlCommand sqlCom5 =new SqlCommand("sp4TWRetrieveItemPhotos"); sqlCom5.Connection = dbConn5; sqlCom5.CommandType = CommandType.StoredProcedure; sqlCom5.Parameters.Add("@ID", SqlDbType.Int); sqlCom5.Parameters["@ID"].Value =ID; dbConn5.Open(); SqlDataReader myDataReader; myDataReader = sqlCom5.ExecuteReader(CommandBehavior.CloseConnection); DataGrid3.DataSource = sqlCom5.ExecuteReader(); DataGrid3.DataBind(); while(myDataReader.Read()) { Response.ContentType = myDataReader.Items("JPEG"); Response.BinaryWrite(myDataReader.Items("InventoryItemPhoto")); } dbConn5.Close(); } #region Web Form Designer generated code override protected void OnInit(EventArgs e) { // // CODEGEN: This call is required by the ASP.NET Web Form Designer. // InitializeComponent(); base.OnInit(e); } /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.Load += new System.EventHandler(this.Page_Load); } #endregion }}
Hey, I've been having problems - when trying to insert a new row i've been trying to get back the unique ID for that row. I've added "SELECT @MY_ID = SCOPE_IDENTITY();" to my query but I am unable get the data. If anyone has a better approach to this let me know because I am having lots of problems. Thanks,Lang
Hello Everyone and thanks for your help in advance. I am working on an application that connects to SQL Server. I need to find out if there is any way (I know there is, not sure how) to retrieve a list of tables within a database and also, a way to retrieve a list of databases within a server. I am using VB.Net in a web application. Any help on this owuld be greatly appreciated.
I am using several TextBox Controls, instead of a FormView, for inserting data into a Sql Database. The primary key (ID) is an integer which is automatically incremented by one at each insertion. At each insertion I need to retrieve the ID value of the newly inserted record. I have followed a suggestion from a help sample with this code:Imports System.Data.CommonImports System.Data.SqlClientImports System.DataPartial Class InsertInherits System.Web.UI.PageProtected Sub LinkButton1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles LinkButton1.ClickSqlDataSource1.Insert()End SubSub On_Inserting(ByVal sender As Object, ByVal e As SqlDataSourceCommandEventArgs)Dim InsertedKey As SqlParameterInsertedKey = New SqlParameter("@PK_GuestList", SqlDbType.Int)InsertedKey.Direction = ParameterDirection.Outpute.Command.Parameters.Add(InsertedKey)End SubSub On_Inserted(ByVal sender As Object, ByVal e As SqlDataSourceStatusEventArgs)Dim command As DbCommandcommand = e.CommandLabel1.Text = command.Parameters("@PK_GuestList").Value.ToString()End SubEnd ClassNo output appears on the Label1.If in the last code row I replace "@PK_GuestList" with the name of any TextBox used for inputting data, its content is correctly shown in Label1.Where is the problem?
hi all, I have a table productprice which has the following feildsid price datecreated productname 1 12.00 13/05/2007 a1 2 23.00 14/05/2007 a13 24.00 15/05/2007 a14 56.00 13/05/2007 b15 34.00 18/05/2007 b16 23.00 21/05/2007 b17 11.00 12/02/2007 c1 8 78.00 12/03/2007 c2I need to select the rows that are highlighted here.. ie the row that has the max(datecreated) for all the productname in the table.. plz help thanks in advance..