Search Results

Search found 40393 results on 1616 pages for 'single table inheritance'.

Page 15/1616 | < Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >

  • Master Page: Dynamically Adding Rows in ASP Table on Button Click event

    - by Vincent Maverick Durano
    In my previous post here, I wrote an example that demonstrates how are we going to generate table rows dynamically using ASP Table on click of the Button control. Now based on some comments in my previous example and in the forums they wanted to implement it within Masterpage. Unfortunately the code in my previous example doesn't work in Masterpage for the following main reasons: The Table is dynamically added within the Form tag and so the TextBox control will not be generated correcty in the page. The data will not be retained on each and every postbacks because the SetPreviousData() method is looking for the Table element within the Page and not on the MasterPage. The Request.Form key value should be set correctly since all controls within the master page are prefixed with the naming containter ID to prevent duplicate ids on the final rendered HTML. For example the TextBox control with the ID of TextBoxRow will turn to ID to this ctl00$MainBody$TextBoxRow. In order for the previous example to work within Masterpage then we will have to correct those three main reasons above and this post will guide you how to correct it. Suppose we have this content page declaration below:   <asp:Content ID="Content1" ContentPlaceHolderID="MainHead" Runat="Server"> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="MainBody" Runat="Server"> <asp:PlaceHolder ID="PlaceHolder1" runat="server"> <asp:Button ID="BTNAdd" runat="server" Text="Add New Row" OnClick="BTNAdd_Click" /> </asp:PlaceHolder> </asp:Content> As you notice I've added a PlaceHolder control within the MainBody ContentPlaceHolder. This is because we are going to generate the Table in the PlaceHolder instead of generating it within the Form element. Now since issue #1 is already corrected then let's proceed to the code beind part. Here are the full code blocks below:     using System; using System.Web.UI; using System.Web.UI.WebControls; public partial class DynamicControlDemo : System.Web.UI.Page { private int numOfRows = 1; protected void Page_Load(object sender, EventArgs e) { //Generate the Rows on Initial Load if (!Page.IsPostBack) { GenerateTable(numOfRows); } } protected void BTNAdd_Click(object sender, EventArgs e) { if (ViewState["RowsCount"] != null) { numOfRows = Convert.ToInt32(ViewState["RowsCount"].ToString()); GenerateTable(numOfRows); } } private void SetPreviousData(int rowsCount, int colsCount) { Table table = (Table)this.Page.Master.FindControl("MainBody").FindControl("Table1"); // **** if (table != null) { for (int i = 0; i < rowsCount; i++) { for (int j = 0; j < colsCount; j++) { //Extracting the Dynamic Controls from the Table TextBox tb = (TextBox)table.Rows[i].Cells[j].FindControl("TextBoxRow_" + i + "Col_" + j); //Use Request object for getting the previous data of the dynamic textbox tb.Text = Request.Form["ctl00$MainBody$TextBoxRow_" + i + "Col_" + j];//***** } } } } private void GenerateTable(int rowsCount) { //Creat the Table and Add it to the Page Table table = new Table(); table.ID = "Table1"; PlaceHolder1.Controls.Add(table);//****** //The number of Columns to be generated const int colsCount = 3;//You can changed the value of 3 based on you requirements // Now iterate through the table and add your controls for (int i = 0; i < rowsCount; i++) { TableRow row = new TableRow(); for (int j = 0; j < colsCount; j++) { TableCell cell = new TableCell(); TextBox tb = new TextBox(); // Set a unique ID for each TextBox added tb.ID = "TextBoxRow_" + i + "Col_" + j; // Add the control to the TableCell cell.Controls.Add(tb); // Add the TableCell to the TableRow row.Cells.Add(cell); } // And finally, add the TableRow to the Table table.Rows.Add(row); } //Set Previous Data on PostBacks SetPreviousData(rowsCount, colsCount); //Sore the current Rows Count in ViewState rowsCount++; ViewState["RowsCount"] = rowsCount; } }   As you observed the code is pretty much similar to the previous example except for the highlighted lines above. That's it! I hope someone find this post usefu! Technorati Tags: Dynamic Controls,ASP.NET,C#,Master Page

    Read the article

  • How do you make a CSS-defined table-cell scroll?

    - by Giffyguy
    I want to be able to set the height of the table, and force the cells to scroll individually if they are larger than the table. Consider the following code: (see it in action here) <div style="display: table; position: absolute; width: 25%; height: 80%; min-height: 80%; max-height: 80%; left: 0%; top: 10%; right: 75%; bottom: 10%; border: solid 1px black;"> <div style="display: table-row;"> <div style="display: table-cell; border: solid 1px blue;"> {Some dynamic text content}<br/> This cell should shrink to fit it's contents. </div> </div> <div style="display: table-row;"> <div style="display: table-cell; border: solid 1px red; overflow: scroll;"> This should only take up the remainder of the table's vertical space. This should only take up the remainder of the table's vertical space. This should only take up the remainder of the table's vertical space. This should only take up the remainder of the table's vertical space. This should only take up the remainder of the table's vertical space. This should only take up the remainder of the table's vertical space. This should only take up the remainder of the table's vertical space. This should only take up the remainder of the table's vertical space. </div> </div> </div> If you open this code (in IE8, in my case) you'll notice that the second cell fits in the table nicely when the browser is maximized. In theory, when you shrink the browser (forcing the table to shrink as well), a vertical scrollbar should appear INSIDE the second cell when the table becomes too small to fit all of the content. But in reality, the table just grows vertically, beyond the bounds set by the CSS height attribute(s). Hopefully I've explained this scenario adequately... Does anyone know how I can get this to work?

    Read the article

  • How do you make a CSS-defined table-cell scroll?

    - by Giffyguy
    I want to be able to set the height of the table, and force the cells to scroll individually if they are larger than the table. Consider the following code: (see it in action here) <div style="display: table; position: absolute; width: 25%; height: 80%; min-height: 80%; max-height: 80%; left: 0%; top: 10%; right: 75%; bottom: 10%; border: solid 1px black;"> <div style="display: table-row;"> <div style="display: table-cell; border: solid 1px blue;"> {Some dynamic text content}<br/> This cell should shrink to fit it's contents. </div> </div> <div style="display: table-row;"> <div style="display: table-cell; border: solid 1px red; overflow: scroll;"> This should only take up the remainder of the table's vertical space. This should only take up the remainder of the table's vertical space. This should only take up the remainder of the table's vertical space. This should only take up the remainder of the table's vertical space. This should only take up the remainder of the table's vertical space. This should only take up the remainder of the table's vertical space. This should only take up the remainder of the table's vertical space. This should only take up the remainder of the table's vertical space. </div> </div> </div> If you open this code (in IE8, in my case) you'll notice that the second cell fits in the table nicely when the browser is maximized. In theory, when you shrink the browser (forcing the table to shrink as well), a vertical scrollbar should appear INSIDE the second cell when the table becomes too small to fit all of the content. But in reality, the table just grows vertically, beyond the bounds set by the CSS height attribute(s). Hopefully I've explained this scenario adequately... Does anyone know how I can get this to work?

    Read the article

  • Hibernate: Parent/Child relationship in a single-table

    - by Dee
    I hardly see any pointer on the following problem related to Hibernate. This pertains to implementing inheritance using a single database table with a parent-child relationship to itself. For example: CREATE TABLE Employee ( empId BIGINT NOT NULL AUTO_INCREMENT, empName VARCHAR(100) NOT NULL, managerId BIGINT, CONSTRAINT pk_employee PRIMARY KEY (empId) ) Here, the managerId column may be null, or may point to another row of the Employee table. Business rule requires the Employee to know about all his reportees and for him to know about his/her manager. The business rules also allow rows to have null managerId (the CEO of the organisation doesn't have a manager). How do we map this relationship in Hibernate, standard many-to-one relationship doesn't work here? Example code would be appreciated.

    Read the article

  • Hibernate: Parent/Child relationship in a single-table

    - by Dee
    I hardly see any pointer on the following problem related to Hibernate. This pertains to implementing inheritance using a single database table with a parent-child relationship to itself. For example: CREATE TABLE Employee ( empId BIGINT NOT NULL AUTO_INCREMENT, empName VARCHAR(100) NOT NULL, managerId BIGINT, CONSTRAINT pk_employee PRIMARY KEY (empId) ) Here, the managerId column may be null, or may point to another row of the Employee table. Business rule requires the Employee to know about all his reportees and for him to know about his/her manager. The business rules also allow rows to have null managerId (the CEO of the organisation doesn't have a manager). How do we map this relationship in Hibernate, standard many-to-one relationship doesn't work here? Example code would be appreciated.

    Read the article

  • Rotate Windows.Documents.Table

    - by Neverrav
    I need to rotate a table clockwise up to 90 degrees. It's one of the blocks of a FlowDocument. Is there a way to apply some kind of rotation to a Table? The possible solution of creating TextEffect like this: var table = new Table(); ... // fill the table here var effect = new TextEffect { Transform = new RotationTransform(90), PositionStart = 0, PositionCount = int.MaxValue }; table.TextEffects = new TextEffectCollection(); table.TextEffects.Add(effect); doesn't work.

    Read the article

  • HTML align table rows on top

    - by arik-so
    Hello, I have an HTML table. It looks as follows: <table> <tr> <td>Content one</td> <td rowspan="2"> Very long content right</td> </tr> <tr> <td>Content two</td> </tr> </table> As you see, I have some very long content on the right side of the table, actually, it is so long that it does not fit into what height is given by the table rows, and so the table gets higher, and by doing that, the contents one and two are no longer at the top of the table, but distribute themselves along the whole height. How can I stop them from doing this?

    Read the article

  • Single SingOn - Best practice

    - by halfdan
    Hi Guys, I need to build a scalable single sign-on mechanism for multiple sites. Scenario: Central web application to register/manage account (Server in Europe) Several web applications that need to authenticate against my user database (Servers in US/Europe/Pacific region) I am using MySQL as database backend. The options I came up with are either replicating the user database across all servers (data security?) or allowing the servers to directly connect to my MySQL instance by explicitly allowing connections from their IPs in my.cnf (high load? single point of failure?). What would be the best way to provide a scalable and low-latency single sign-on for all web applications? In terms of data security would it be a good idea to replicate the user database across all web applications? Note: All web applications provide an API which users can use to embed widgets into their own websites. These widgets work through a token auth mechanism which will again need to authenticate against my user database.

    Read the article

  • Single SignOn - Best practice

    - by halfdan
    Hi Guys, I need to build a scalable single sign-on mechanism for multiple sites. Scenario: Central web application to register/manage account (Server in Europe) Several web applications that need to authenticate against my user database (Servers in US/Europe/Pacific region) I am using MySQL as database backend. The options I came up with are either replicating the user database across all servers (data security?) or allowing the servers to directly connect to my MySQL instance by explicitly allowing connections from their IPs in my.cnf (high load? single point of failure?). What would be the best way to provide a scalable and low-latency single sign-on for all web applications? In terms of data security would it be a good idea to replicate the user database across all web applications? Note: All web applications provide an API which users can use to embed widgets into their own websites. These widgets work through a token auth mechanism which will again need to authenticate against my user database.

    Read the article

  • Cannot open Pivot Table source file

    - by Ken
    Excel Pivot table error is: Cannot open Pivot Table source file C:\Users\UserName\AppData\Roaming\Microsoft\Excel\DatabaseName (version1).TableName I’ve seen other questions and answers with the same topic, but I think this is different. I believe I know why the error is occurring: Excel closed unexpectantly and did autosave with (version1) attached to the original file name and saved it in the C:\User etc. above , which is the default recovery location. I opened the recovered file in Excel, saved it as version1 on the server where the original file was located, deleted the original file, and renamed the version1 to the original name. When I go to PivotTable Tools? Options? Change Data Source, it shows only the Table and Range, which are correct, but it does not show the file name or path. The version1 and the renamed file both had the same structure, so the same source table was in both, by they were different files. How do I change the source file from what it is looking for to my renamed file? PS- The (version1) file that it says it is looking for is not in the autosave location, i.e. it is not at the path where it says it is looking in. Thank you for any help Ken

    Read the article

  • repair partition table

    - by m.sr
    Hallo. I've just overwritten my partition table of my system's hard disk. i made a cfdisk on the wrong device (/dev/sda instead of /dev/sdd), deleted all partitions, made one new primary spanning over the whole device, set its type to 07 (NTFS) and hit write. So here i am with my system running. Until i reboot, i hope/guess nothing will change - meaning: all my data is accessible (I'm currently making a dd-backup of the whole device and plan to make a .tar.gz-backup of the most important data later). I also backed up /proc/partitions, /proc/diskstats (even though i guess this is more about throughput and stuff like this ...) and /sys/block/sda/sda?/{start,size}. Some further things i know: 4 primary partitions 1st partition: ~100Mb, ext3, /boot 2nd partition: ~100Mb, "Win7 Boot Partition", ntfs(?) 3rd partition: ~20...30GB, Win7, ntfs 4th partition: ~20...30GB, luks-encrypted device The luks- de crypted device is a LVM-PV The /, /home & swap-partitions are all LVs on the (VG on the) above noted PV So my questions: What is the simplest way to just write the kernels partition table to the disk? What is the simplest way to take the above mentioned (and perhaps other I don't know of ...) data and generate the partition table? Are there any problems to take care of regarding to luks and/or lvm? Is there any data I should backup before rebooting (meanig stuff from kernel [ /sys/..., /proc/...] and so on, which could help me regenerate the partition table)? Thanks a lot! P.S.: debian sid, Kernel 2.6.34-1-amd64 from debian-experimental, 80GB Intel SSD

    Read the article

  • Excel 2007 pivot table does not aggregate properly

    - by Patrick
    I am using a an excel pivot table to summarize some data and just found a problem. The problem deals with how aggregate values are calculated. Let's say I have a table of data with three columns: Name, Date, Value. If I create a table where Name and then Date are used as Row Labels and Value is the aggregate value, ie Average. The pivot table will look something like this: +John .3450 5/14/2010 1.234 5/15/2010 3.450 5/16/2010 -3.25 What I think should be happening here is that the values for each date are averaged and then those values are averaged to come up with the value in the same row as the Name, John. But that is not what it does. It takes the average for each date, which it shows across from the date, but then instead of taking the average of those numbers, it actually uses the raw data and computes the average for all of John's values. It should show the average of the daily averages to correspond with the tree hierarchy, but instead just shows me the average for all of John's values. It essential will only aggregate at one level, but visually creates sub levels that it is not using. Does anyone know how to change this or understand by what logic this makes sense? Why would I create any sub groupings if I cannot compute aggregates on them?

    Read the article

  • Pivot table not refreshing sort order

    - by William Anthony
    I have Pivot Table that get its data source from another sheet, same workbook. I want the sort order of data is same as the data source order, I choose "Sort in data source order" in Pivot Table option. The problem is, when I change the data order on data source worksheet, then I refresh the Pivot Table, the sort order didn't change. I googled that the Pivot Table should be unlink first then re-link again in order to work properly, so I tried the following: The original data source has named range: origdata. The fake data source has names range: dummydata I changed manually data source to dummydata then changed back to origdata. The sort order did change as expected. Now I want to make the operation automated, so I'm using this code in Worksheet.activate event. Note that, PT is PivotTable instance. ... PT.SourceData = "dummydata" PT.RefreshTable PT.SourceData = "origdata" PT.RefreshTable ... Change data source from VBA didn't change the sort order just like I did with manual method. Why is that? Am I missing something? Maybe there are some routine called when I changed the data source manually via toolbar button? Thanks in advance for your help.

    Read the article

  • How to return children objects?

    - by keruilin
    I have -- what I think -- is a simple question. Here's my code: class Fruit < ActiveRecord::Base end class Apple < Fruit end class Kiwi < Fruit end Assume that I have all the STI setup correctly, and there are multiple types of Apple and Kiwi records in the table. From here... fruits = Fruit.find(:all) ...how do I return an array of just Apples from the fruits array?

    Read the article

  • How to isolate data per customer, Django powered website

    - by Sawwy
    I have recently started learning python and django and working on a project that includes building a website for collecting information from customers. I am currently trying to figure out best way to isolate the customer data (collected information is sensitive and should only be accessible by customer and the service provider). I found this post Postgresql - one database for everyone, or one-database per customer and my question is that can I automate the model inheritance with customer creation via admin? To be specific, when save() is called for adding customer via django admin, this should create the customer specific tables (create a new set of tables with 'company_name' -prefix). For more information of the environment, I have extended the basic user registration with custom UserProfile adding 'company' and 'role' fields for each user. Upon login, the 'company' of the user will be checked to filter out tables without the 'company_name' prefix. 'Role' will further filter the which company-specific tables and set rights (view, edit). will appreciate any suggestions if more elegant methods could be used to solve the data isolation problem than model inheritance.

    Read the article

  • How to change Excel Pivot table "Report Filter"s values cell formatting

    - by Damiqib
    My Excel is in Finnish, but don't let that bother you... First Report Filter "Kupi" has only number values in my source table, for example 643203, 3533, 253244, etc. How ever in Pivot's "Report Filter" all those values are converted to date values MONTH yyyy. How do I reformat the filter values to respect the original cell formatting?! The same problem is with actual date values in my source table when using "Report Filter" in Pivot table. In my source data my dates are in format: dd.mm.yyyy and for some reason in Pivot's "Report Filter" all dates are shown in MONTH yyyy-format?! Why is that and what do I need to do to fix this?

    Read the article

  • multiple count Pivot table in Excel

    - by Sivakanesh
    Hi all, I'm trying to put togeter a pivot table from an Excel spreadsheet. The spreadsheets look similar to the following: DeptHead, Emp, Increment x, A, 2.5% x, B, y, C, 1.5% y, D, y, E, 2.0% I would like to make a pivot table that looks like the following; DeptHead, CountOfEmp, CountOfIncrement x, 2, 1 y, 3, 2 So it provides a count of total number of Emps and total number Increments for each DeptHead ignoring the blanks. I have tried to do this in many ways in Pivot table, but the two counts are only appearing in rows and not in columns as above. Is there any way to achieve this please? Thanks

    Read the article

  • Excel Pivot table: Calculated field based on only the first row of a group

    - by Meysam
    I've got the following data and pivot table: The Total column in the pivot table is the sum of the following calculated field: =start-TIME(7, 30, 0) I know that this calculation is wrong for what I want to achieve. I need to know how much delay I have had on each day to start the work. e.g. on 1-Oct-12, assuming I should have started my work at 7:30, 8:00 - 7:30 which yields 30 minutes delay, 1 hour delay for 2-Oct-12 and 50 minutes for 3-Oct-12. So my question is, how can I have a calculated field based on only the first row of each group in a pivot table?

    Read the article

  • Using Table-Valued Parameters in SQL Server

    - by Jesse
    I work with stored procedures in SQL Server pretty frequently and have often found myself with a need to pass in a list of values at run-time. Quite often this list contains a set of ids on which the stored procedure needs to operate the size and contents of which are not known at design time. In the past I’ve taken the collection of ids (which are usually integers), converted them to a string representation where each value is separated by a comma and passed that string into a VARCHAR parameter of a stored procedure. The body of the stored procedure would then need to parse that string into a table variable which could be easily consumed with set-based logic within the rest of the stored procedure. This approach works pretty well but the VARCHAR variable has always felt like an un-wanted “middle man” in this scenario. Of course, I could use a BULK INSERT operation to load the list of ids into a temporary table that the stored procedure could use, but that approach seems heavy-handed in situations where the list of values is usually going to contain only a few dozen values. Fortunately SQL Server 2008 introduced the concept of table-valued parameters which effectively eliminates the need for the clumsy middle man VARCHAR parameter. Example: Customer Transaction Summary Report Let’s say we have a report that can summarize the the transactions that we’ve conducted with customers over a period of time. The report returns a pretty simple dataset containing one row per customer with some key metrics about how much business that customer has conducted over the date range for which the report is being run. Sometimes the report is run for a single customer, sometimes it’s run for all customers, and sometimes it’s run for a handful of customers (i.e. a salesman runs it for the customers that fall into his sales territory). This report can be invoked from a website on-demand, or it can be scheduled for periodic delivery to certain users via SQL Server Reporting Services. Because the report can be created from different places and the query to generate the report is complex it’s been packed into a stored procedure that accepts three parameters: @startDate – The beginning of the date range for which the report should be run. @endDate – The end of the date range for which the report should be run. @customerIds – The customer Ids for which the report should be run. Obviously, the @startDate and @endDate parameters are DATETIME variables. The @customerIds parameter, however, needs to contain a list of the identity values (primary key) from the Customers table representing the customers that were selected for this particular run of the report. In prior versions of SQL Server we might have made this parameter a VARCHAR variable, but with SQL Server 2008 we can make it into a table-valued parameter. Defining And Using The Table Type In order to use a table-valued parameter, we first need to tell SQL Server about what the table will look like. We do this by creating a user defined type. For the purposes of this stored procedure we need a very simple type to model a table variable with a single integer column. We can create a generic type called ‘IntegerListTableType’ like this: CREATE TYPE IntegerListTableType AS TABLE (Value INT NOT NULL) Once defined, we can use this new type to define the @customerIds parameter in the signature of our stored procedure. The parameter list for the stored procedure definition might look like: 1: CREATE PROCEDURE dbo.rpt_CustomerTransactionSummary 2: @starDate datetime, 3: @endDate datetime, 4: @customerIds IntegerListTableTableType READONLY   Note the ‘READONLY’ statement following the declaration of the @customerIds parameter. SQL Server requires any table-valued parameter be marked as ‘READONLY’ and no DML (INSERT/UPDATE/DELETE) statements can be performed on a table-valued parameter within the routine in which it’s used. Aside from the DML restriction, however, you can do pretty much anything with a table-valued parameter as you could with a normal TABLE variable. With the user defined type and stored procedure defined as above, we could invoke like this: 1: DECLARE @cusomterIdList IntegerListTableType 2: INSERT @customerIdList VALUES (1) 3: INSERT @customerIdList VALUES (2) 4: INSERT @customerIdList VALUES (3) 5:  6: EXEC dbo.rpt_CustomerTransationSummary 7: @startDate = '2012-05-01', 8: @endDate = '2012-06-01' 9: @customerIds = @customerIdList   Note that we can simply declare a variable of type ‘IntegerListTableType’ just like any other normal variable and insert values into it just like a TABLE variable. We could also populate the variable with a SELECT … INTO or INSERT … SELECT statement if desired. Using The Table-Valued Parameter With ADO .NET Invoking a stored procedure with a table-valued parameter from ADO .NET is as simple as building a DataTable and passing it in as the Value of a SqlParameter. Here’s some example code for how we would construct the SqlParameter for the @customerIds parameter in our stored procedure: 1: var customerIdsParameter = new SqlParameter(); 2: customerIdParameter.Direction = ParameterDirection.Input; 3: customerIdParameter.TypeName = "IntegerListTableType"; 4: customerIdParameter.Value = selectedCustomerIds.ToIntegerListDataTable("Value");   All we’re doing here is new’ing up an instance of SqlParameter, setting the pamameters direction, specifying the name of the User Defined Type that this parameter uses, and setting its value. We’re assuming here that we have an IEnumerable<int> variable called ‘selectedCustomerIds’ containing all of the customer Ids for which the report should be run. The ‘ToIntegerListDataTable’ method is an extension method of the IEnumerable<int> type that looks like this: 1: public static DataTable ToIntegerListDataTable(this IEnumerable<int> intValues, string columnName) 2: { 3: var intergerListDataTable = new DataTable(); 4: intergerListDataTable.Columns.Add(columnName); 5: foreach(var intValue in intValues) 6: { 7: var nextRow = intergerListDataTable.NewRow(); 8: nextRow[columnName] = intValue; 9: intergerListDataTable.Rows.Add(nextRow); 10: } 11:  12: return intergerListDataTable; 13: }   Since the ‘IntegerListTableType’ has a single int column called ‘Value’, we pass that in for the ‘columnName’ parameter to the extension method. The method creates a new single-columned DataTable using the provided column name then iterates over the items in the IEnumerable<int> instance adding one row for each value. We can then use this SqlParameter instance when invoking the stored procedure just like we would use any other parameter. Advanced Functionality Using passing a list of integers into a stored procedure is a very simple usage scenario for the table-valued parameters feature, but I’ve found that it covers the majority of situations where I’ve needed to pass a collection of data for use in a query at run-time. I should note that BULK INSERT feature still makes sense for passing large amounts of data to SQL Server for processing. MSDN seems to suggest that 1000 rows of data is the tipping point where the overhead of a BULK INSERT operation can pay dividends. I should also note here that table-valued parameters can be used to deal with more complex data structures than single-columned tables of integers. A User Defined Type that backs a table-valued parameter can use things like identities and computed columns. That said, using some of these more advanced features might require the use the SqlDataRecord and SqlMetaData classes instead of a simple DataTable. Erland Sommarskog has a great article on his website that describes when and how to use these classes for table-valued parameters. What About Reporting Services? Earlier in the post I referenced the fact that our example stored procedure would be called from both a web application and a SQL Server Reporting Services report. Unfortunately, using table-valued parameters from SSRS reports can be a bit tricky and warrants its own blog post which I’ll be putting together and posting sometime in the near future.

    Read the article

  • Rails object inheritence with belongs_to

    - by Rabbott
    I have a simple has_many/belongs_to relationship between Report and Chart. The issue I'm having is that my Chart model is a parent that has children. So in my Report model I have class Report < ActiveRecord::Base has_many :charts end And my Chart model is a parent, where Pie, Line, Bar all inherit from Chart. I'm not sure where the belongs_to :report belongs within the chart model, or children of chart model. I get errors when I attempt to access chart.report because the object is of type "Class" undefined local variable or method `report' for #< Class:0x104974b90 The Chart model uses STI so its pulling say.. 'Pie' from the chart_type column in the charts table.. what am I missing?

    Read the article

  • PHP mysql multi-table search returning different table and field data row after row

    - by Kinyanjui Kamau
    Hi Guys, I am building a social networking site that is dedicated to nightclubs and night events. Among other tables, I have a users table, events table and establishments table. I am really intrigued with how Facebook in particular is able to query and return matches of not just users but also pages, ads etc row after row. Im sure most who are reading this have tried the facebook search My question is in my case, should I: Perform 3 separate LIKE %search% on each of the tables on search.php. Draw up 3 separate tables to show the results of what matches in the relevant queries which are collapsed when empty(on the same search.php) ie In search.php //query users table $query_user = "SELECT user_first_name, user_last_name, username, picture_thumb_url, avatar FROM users JOIN picture ON users.user_id = picture.user_id AND picture.avatar=1 ORDER BY users.user_id"; $result_users = mysql_query($query_user, $connections) or die(mysql_error()); $row_result_users = mysql_fetch_assoc($wid_updates); //query events table $query_event = "SELECT event_thumb_url, event_name, event_venue, event_date FROM event WHERE event_name LIKE '%".$search_value."%'"; $event = mysql_query($query_event, $connections) or die(mysql_error()); $row_event = mysql_fetch_assoc($event); $totalRows_event = mysql_num_rows($event); //query establishments table $query_establishment = "SELECT establishment_thumb_url, establishment_name, location_id, establishment_pricing FROM establishment WHERE establishment_name LIKE '%".$search_value."%'"; $establishment = mysql_query($query_establishment, $connections) or die(mysql_error()); $row_establishment = mysql_fetch_assoc($establishment); $totalRows_establishment = mysql_num_rows($establishment); My html: <table max-width="500" name="users" border="0"> <tr> <td width="50" height="50"></td> <td width="150"></td> <td width="150"></td> <td width="150"></td> </tr> </table> <table width="500" name="events" border="0"> <tr> <td width="50" height="50"><a href="#profile.php"><img src="Images/<?php echo $row_event['event_thumb_url']; ?>" border="0" height="50" width="50"/></a></td> <td width="150"><?php echo $row_event['event_name']; ?></td> <td width="150"><?php echo $row_event['event_venue']; ?></td> <td width="150"><?php echo $row_event['event_date']; ?></td> </tr> </table> <table width="500" name="establishments" border="0"> <tr> <td width="50" height="50"><a href="#profile.php"><img src="Establishment_Images/<?php echo $row_establishment['establishment_thumb_url']; ?>" border="0" height="50" width="50"/></a></td> <td width="150"><?php echo $row_establishment['establishment_name']; ?></td> <td width="150"><?php echo $row_establishment['location_id']; ?></td> <td width="150"><?php echo $row_establishment['establishment_pricing']; ?></td> </tr> </table> I haven't populated the PHP echo's for the user table. This is just to give you an idea of what I am trying to do. Any assistance?

    Read the article

  • Back up a single table in SQL Server

    - by BuckWoody
    SQL Server doesn’t have an easy way to take a table backup, so I often use the bcp (Bulk Copy Program) to accomplish the same goal. I’ve mentioned this before, and someone told me when they tried it they couldn’t restore the table – ah the dangers of telling people half the information! I should have mentioned that you need to have a “format file” ready if the table does not exist at the destination. In my case I already had the table, in this person’s case they did not. The format file can be used to rebuild that table structure before the data is bcp’d in, and you can read more about it here: http://msdn.microsoft.com/en-us/library/ms191516.aspx There’s another way to back up a table, and that’s to create a Filegroup and place the table there. Then you can take a Filegroup backup to back up a single table. Of course, there are other methods of moving a single table’s data in an out, including SQL Server Integration Services and even the older Data Transformation Services, or simply by using hte SQLCMD or PowerShell utilities to run a query and just save the output to a file. In fact, these days I’m using a PowerShell script to build INSERT statements from that query. That could also easily be modified to create the table structure (or modify one if needed) quite easily. Share this post: email it! | bookmark it! | digg it! | reddit! | kick it! | live it!

    Read the article

  • 3 column layout with css display table, with first row having multiple rows?

    - by Damainman
    I am working on a new website which: Has 3 columns - Each Column being a cell First column has 3 rows (Logo, Nav, icons) - Has a Div with display: table which wraps arround 3 divs with display:table-row. Other two columns only have 1 row. With the middle column being the content area. However since this is my first time using display:table, I am running into some things that aren't so clear to me. I was trying to avoid floating divs. If I need multiple rows with one cell in each row per column, do I embed each cell in a row or just create each row and not declare cells. I understand that browsers automatically create the missing elements but I want to make sure I do this properly to avoid any side effects that might occur due to the browser automatically creating the missing elements. Edit: I think my brain is just over worked, I guess I can accomplish this by just using 3 divs in the first column instead of using a nested table div with the rows. This just popped into my head.

    Read the article

  • Why avoid Java Inheritance "Extends"

    - by newbie
    Good day! Jame Gosling said “You should avoid implementation inheritance whenever possible.” and instead, use interface inheritance. But why? How can we avoid inheriting the structure of an object using the keyword "extends", and at the same time make our code Object Oriented? Could someone please give an Object Oriented example illustrating this concept in a scenario like "ordering a book in a bookstore?" Thank you in advance.

    Read the article

  • [wordpress] Loop through a specific category on single.php

    - by petrescu
    I've created a custom page and it is set as my homepage, within this custom page I am pulling out the latest post from a specific category, I've also created a form of pagination which when clicked upon will take the user to single.php. My intention for the single.php is to have two custom loops. Custom loop one I want single.php to distinguish that it has came from the homepage and loop through all of the posts tagged with the same category as the one on the homepage. Some of these posts will have to be tagged with more than one category, so the loop will have to know to ignore the other categories and just pay attention to the category in question. Does that make sense? Custom loop two If the user hasn't arrived from the homepage, single.php will just act as it normally does i.e, if the user comes from index.php (the blog) they will be taken to this second loop (blog post) However I don't seem to be able to make the distinction between the two loops, I might be over complicating matters, as I've got a loop which wraps everything together and then I have a loop for my custom pagination. Here is the code below to show you what I'm talking about custompage.php (set to home) - This works just fine but I'll post it just incase anyone is able to tidy it up <?php query_posts('cat=1'); ?> <?php $myPosts = new WP_Query(); $myPosts->query('showposts=1'); if (have_posts()) : while ($myPosts->have_posts()) : $myPosts->the_post(); ?> <script type="text/javascript">$.backstretch("<?php $key="image"; echo get_post_meta($post->ID, $key, true);?>");</script> <div id="post-<?php the_ID(); ?>" class="info"> <h2><?php the_title(); ?></h2> <ul class="nav"> <?php query_posts('posts_per_page=1&offset=1'); the_post(); ?> <li class="prev"><a href="<?php the_permalink() ?>">Previous</a></li> <?php wp_reset_query(); ?> <li class="next"></li> </ul> </div> <!-- end .info --> <?php endwhile; endif; ?> <?php wp_reset_query(); ?> single.php - Currently broken <?php if( in_category('1') ) { ?> <!-- start --> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div id="post-<?php the_ID(); ?>" class="info"> <script type="text/javascript">$.backstretch("<?php $key="image"; echo get_post_meta($post->ID, $key, true);?>");</script> <h2><?php the_title(); ?></h2> <ul class="nav"> <li class="prev"><?php previous_post_link('%link', '&nbsp;', 'true', '1') ?></li> <li class="next"><?php next_post_link('%link', '&nbsp;', 'true', '1'); ?></li> <!--li class="prev"><?php //previous_post_link('%link', '%title;', 'true', '1') ?></li> <li class="next"><?php //next_post_link('%link', '%title;', 'true', '1'); ?></li--> </ul> </div> <!-- end .info --> <?php endwhile; else: ?> <?php endif; ?> <!-- end --> <?php }else{ ?> <div id="content" class="widecolumn" role="main"> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div <?php post_class() ?> id="post-<?php the_ID(); ?>"> <h2><?php the_title(); ?></h2> <div class="entry"> <?php the_content('<p class="serif">Read the rest of this entry &raquo;</p>'); ?> </div> </div> <?php comments_template(); ?> <?php endwhile; else: ?> <p>Sorry, no posts matched your criteria.</p> <?php endif; ?> </div> <?php } ?> The problem I seem to be running into is when a post has been tagged with two categories, wordpress doesn't seem to be able to make the distinction between the two categories and instead of carrying on to the next category it breaks and defaults to the second loop.

    Read the article

< Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >