Search Results

Search found 1168 results on 47 pages for 'datatable'.

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

  • Defining DateDiff for a calculated column in a datatable

    - by Nir
    I have the column DateTimeExpired, and I would like to create another column called "Expired" which will show "Yes" or "No" according to the expiration date - "Yes" if the date has already passed. I wrote this: DataColumn colExpirationDate = new DataColumn("DateTimeExpired", typeof(DateTime)); DataColumn colExpired = new DataColumn("Expired", typeof(string), "IIF(DateDiff(DateTimeExpired, date())>= 0,'No','Yes')"); But I get an exception "The expression contains undefined function call DateDiff()." (please note that I always want to get the row, no matter if it's expired or not) How do I set the column's text to the correct form?

    Read the article

  • display sqlite datatable in a jtable

    - by tuxou
    Hi I'm trying to display an sqlite data table in a jtable but i have an error " sqlite is type forward only" how could I display it in a jtable try { long start = System.currentTimeMillis(); Statement state = ConnectionBd.getInstance().createStatement( ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY ); ResultSet res = state.executeQuery("SELECT * FROM data"); ResultSetMetaData meta = res.getMetaData(); Object[] column = new Object[meta.getColumnCount()]; for(int i = 1 ; i <= meta.getColumnCount(); i++){ column[i-1] = meta.getColumnName(i); } res.last(); int rowCount = res.getRow(); Object[][] data = new Object[res.getRow()][meta.getColumnCount()]; res.beforeFirst(); int j = 1; while(res.next()){ for(int i = 1 ; i <= meta.getColumnCount(); i++) data[j-1][i-1] = res.getObject(i); j++; } res.close(); state.close(); long totalTime = System.currentTimeMillis() - start; result.removeAll(); result.add(new JScrollPane(new JTable(data, column)), BorderLayout.CENTER); result.add(new JLabel("execute in " + totalTime + " ms and has " + rowCount + " ligne(s)"), BorderLayout.SOUTH); result.revalidate(); } catch (SQLException e) { result.removeAll(); result.add(new JScrollPane(new JTable()), BorderLayout.CENTER); result.revalidate(); JOptionPane.showMessageDialog(null, e.getMessage(), "ERREUR ! ", JOptionPane.ERROR_MESSAGE); } thank you

    Read the article

  • How to Set a gridview column width when binding to a datatable

    - by Bob Avallone
    I am binding a table to a gridview in asp.net as such grdIssues.DataSource = mdtIssues; grdIssues.DataBind(); The problem is I cannot then control the column width, asp.net seems to decided on it's own what width each column should be. Methods such as grdIssues.Columns[0].ItemStyle.Width = 100; grdIssues.Columns[1].ItemStyle.Width = 100; don't work because the columns are created dynamically. I cannot believe there isn't a way to do this short of manually creating each column and filling each row. Regards, Bob Avallone

    Read the article

  • How to create Query syntax for multiple DataTable for implementing IN operator of Sql Server

    - by Shantanu Gupta
    I have fetched 3-4 tables by executing my stored procedure. Now they resides on my dataset. I have to maintain this dataset for multiple forms and I am not doing any DML operation on this dataset. Now this dataset contains 4 tables out of which i have to fetch some records to display data. Data stored in tables are in form of one to many relationship. i.e. In case of transactions. N records per record. Then these N records are further mapped to M records of 3rd table. Table 1 MAP_ID GUEST_ID DEPARTMENT_ID PARENT_ID PREFERENCE_ID -------------------- -------------------- -------------------- -------------------- -------------------- 19 61 1 1 5 14 61 1 5 15 15 61 2 4 10 18 61 2 13 23 17 61 2 20 26 16 61 40 40 41 20 62 1 5 14 21 62 1 5 15 22 62 1 6 16 24 62 2 3 4 23 62 2 4 9 27 62 2 13 23 25 62 2 20 24 26 62 2 20 25 28 63 1 1 5 29 63 1 1 8 34 63 1 5 15 30 63 2 4 10 33 63 2 4 11 31 63 2 13 23 32 63 40 40 41 35 65 1 NULL 1 36 65 1 NULL 1 38 68 2 13 22 37 68 2 20 25 39 68 2 23 27 40 92 1 NULL 1 Table 2 Department_ID Department_Name Parent_Id Parent_Name -------------------- ----------------------- --------------- ---------------------------------------------------------------------------------- 1 Food 1, 5, 6 Food, North Indian, South Indian 2 Lodging 3, 4, 13, 20, 23 Room, Floor, Non Air Conditioned, With Balcony, Without Balcony 40 New 40 SubNew TABLE 3 Parent_Id Parent_Name Preference_ID Preference_Name -------------------- ----------------------------------------------- ----------------------- ------------------- NULL NULL NULL NULL 1 Food 5, 8 North Indian, Italian 3 Room 4 Floor 4 Floor 9, 10, 11 First, Second, Third 5 North Indian 14, 15 X, Y 6 South Indian 16 Dosa 13 Non Air Conditioned 22, 23 With Balcony, Without Balcony 20 With Balcony 24, 25, 26 Mountain View, Ocean View, Garden View 23 Without Balcony 27 Mountain View 40 New 41 SubNew I have these 3 tables that are related in some fashion like this. Table 1 will be the master for these 2 tables i.e. table 2 and table 3. I need to query on them as SELECT Department_Id, Department_Name, Parent_Name FROM Table2 WHERE Department_Id in ( SELECT Department_Id FROM Table1 WHERE guest_id=65 ) SELECT Parent_Id, Parent_Name, Preference_Name FROM Table3 WHERE PARENT_ID in ( SELECT parent_id FROM Table1 WHERE guest_id=65 ) Now I need to use these queries on DataTables. So I am using Query Syntax for this and reached up to this point. var dept_list= from dept in DtMapGuestDepartment.AsEnumerable() where dept.Field<long>("PK_GUEST_ID")==long.Parse(63) select dept; This should give me the list of all departments that has guest id =63 Now I want to select all departments_name and parent_name from Table 2 where guest_id=63 i.e. departments that i fetched above. This same case will be followed for Table3. Please suggest how to do this. Thanks for keeping up patience for reading my question.

    Read the article

  • Running an existing LINQ query against a dynamic object (DataTable like)

    - by TomTom
    Hello, I am working on a generic OData provider to go against a custom data provider that we have here. Thsi is fully dynamic in that I query the data provider for the table it knows. I have a basic storage structure in place so far based on the OData sample code. My problem is: OData supports queries and expects me to hand in an IQueryable implementation. On the lowe rside, I dont have any query support. Not a joke - the provider returns tables and the WHERE clause is not supported. Performance is not an issue here - the tables are small. It is ok to sort them in the OData provider. My main problem is this. I submit a SQL statement to get out the data of a table. The result is some sort of ADO.NET data reader here. I need to expose an IQueryable implementation for this data to potentially allow later filtering. Any ide ahow to best touch that? .NET 3.5 only (no 4.0 planned for some time). I was seriously thinking of creating dynamic DTO classes for every table (emitting bytecode) so I can use standard LINQ. Right now I am using a dictionary per entry (not too efficient) but I see no real way to filter / sort based on them.

    Read the article

  • Submit Data to a datatable from a View MVC

    - by user54197
    I have a view that I would like to populate data when the next button is clicked. It is 3 Views which will send data on every next button. How do I do this? Below is code I just made up, but should give an idea of what I am looking for. Page 1: <table> <tr> <td><b>Name:</b></td> <td colspan="2"><input id="txtName" type="text" /></td> </tr> </table> <input type="submit" value="Next" /> Page 2: <table> <tr> <td><b>Address:</b></td> <td colspan="2"><input id="txtAddress" type="text" /></td> </tr> </table> <input type="submit" value="Next" /> Page 3: <table> <tr> <td><b>Phone:</b></td> <td colspan="2"><input id="txtPhone" type="text" /></td> </tr> </table> <input type="submit" value="Next" />

    Read the article

  • DataTable display problem in jsf1.1

    - by johnbritto
    I have two datatables. One is to display names. Another contains three <h:selectOneMenu>. I want combine those two datatables. I don't know how to do it? Expected result: ----------------------------------------------- Datatable1 Datatable2 ----------------------------------------------- Lic Date month year Premium Date month year Test Date month year

    Read the article

  • How to write a datatable to excel work book at client side

    - by senthilkumar
    Hi Guys Currently i am doing one project in that we need to generate report from database. Since my server memory is too low im getting 'Out of Memory' Exception when im writing it at serverside and also when i write directly to a excel file using http header as excel file im not able to create multiple sheets since my database table is huge more than 65536 rows. I saw many solution using a third party tool but i cant use those into mine..If anyone already worked on this please give me some direction. Also i tried using javascript but for that i need to use datagrid at server side?? but in my project i m not allowed to use like this.

    Read the article

  • problem of setting cache as datatable and reading it

    - by MyHeadHurts
    and this is how i see if my cache is empty all my syntax errors are coming when i am trying to see if the cache is null and if it is to run the stored procedure If RadioButtonList1.SelectedIndex = 0 Then If Cache["netcache"] = null Then bcmd.CommandText = "yearlynetsales" Else btable = cache["netcache"] end if If RadioButtonList1.SelectedIndex = 1 Then If Cache["salescache"] = null Then bcmd.CommandText = "yearlysales" Else btable = cache["salescache"] end if end if this is how i set my cache If RadioButtonList1.SelectedIndex = 0 Then Cache.Insert("netcache", bTable) ElseIf RadioButtonList1.SelectedIndex = 1 Then Cache.Insert("salescache", bTable) ElseIf RadioButtonList1.SelectedIndex = 2 Then Cache.Insert("cxsalescache", bTable) ElseIf RadioButtonList1.SelectedIndex = 3 Then Cache.Insert("cxvaluecache", bTable) ElseIf RadioButtonList1.SelectedIndex = 4 Then Cache.Insert("othersalescache", bTable) ElseIf RadioButtonList1.SelectedIndex = 5 Then Cache.Insert("inssalescache", bTable) End If

    Read the article

  • Fetch image from folder via datatable does not work after placing image in subdirectory

    - by Arnold Bishkoff
    I am having trouble wrapping my head around the following I have code that fetches an image via smarty in a line img src="getsnap.php?picid={$data[$smarty.section.sec.index].picno|default:$nextpic}&typ=pic&width={$config.disp_snap_width}&height={$config.disp_snap_height}" class="smallpic" alt="" / this works if i pull the image from /temp/userimages/userid/imageNo.ext but because an OS can segfault if you store too many folders or images in a directory i have code that assigns the user image to a subdirectory based upon division of a subdir per 1000 userids. so in thise case i have user id 94 whos images get stored in /siteroot/temp/userimages/000000/94/pic_1.jpg (through 10) or tn_1 (through 10).jpg here is the code for getsnap.php <?php ob_start(); if ( !defined( 'SMARTY_DIR' ) ) { include_once( 'init.php' ); } include('core/snaps_functions.php'); if (isset($_REQUEST['username']) && $_REQUEST['username'] != '') { $userid = $osDB-getOne('select id from ! where username = ?',array(USER_TABLE, $_REQUEST['username']) ); } else { // include ( 'sessioninc.php' ); if( !isset($_GET['id']) || (isset($_GET['id'])&& (int)$_GET['id'] <= 0 ) ) { $userid = $_SESSION['UserId']; } else { $userid = $_GET['id']; } } if (!isset($_GET['picid']) ) { if ((isset($_REQUEST['type']) && $_REQUEST['type'] != 'gallery') || !isset($_REQUEST['type']) ) { $defpic = $osDB-getOne('select picno from ! where userid = ? and ( album_id is null or album_id = ?) and default_pic = ? and active = ? ',array(USER_SNAP_TABLE, $userid,'0','Y','Y' ) ); if ($defpic != '') { $picid = $defpic; } else { $picid = $osDB-getOne('select picno from ! where userid = ? and ( album_id is null or album_id = ?) and active=? order by rand()',array(USER_SNAP_TABLE, $userid,'0','Y' ) ); } unset( $defpic); } } else { $picid = $_GET['picid']; } $typ = isset( $_GET['typ'])?$_GET['typ']:'pic' ; $cond = ''; if ( ($config['snaps_require_approval'] == 'Y' || $config['snaps_require_approval'] == '1') && $userid != $_SESSION['UserId'] ) { $cond = " and active = 'Y' "; } $sql = 'select * from ! where userid = ? and picno = ? '.$cond; //Get the pic $row =& $osDB-getRow ( $sql, array( USER_SNAP_TABLE, $userid, $picid ) ); //Okay pic was found in the DB, Lets actually do something // $id = $userid; $dir = str_pad(($id - ($id % 1000))/100000,6,'0',STR_PAD_LEFT); $zimg = USER_IMAGES_DIR.$dir; $img = getPicture($zimg, $userid, $picid, $typ, $row); //$img = getPicture($userid, $picid, $typ, $row); //$img = getPicture($dir, $userid, $picid, $typ, $row); $ext = ($typ = 'tn')?$row['tnext']:$row['picext']; // Now pic is built as // something pic_x.ext ie pic_2.jpg if ( $img != '' && ( ( hasRight('seepictureprofile') && ( $config['snaps_require_approval'] == 'Y' && $row['active'] == 'Y' ) ||$config['snaps_require_approval'] == 'N' ) || $userid == $_SESSION['UserId'] ) ) { $img2 = $img; //$img2 = $dir.'/'.$img; } else { $gender = $osDB-getOne( 'select gender from ! where id = ?', array( USER_TABLE, $userid ) ) ; if ($gender == 'M') { $nopic = SKIN_IMAGES_DIR.'male.jpg'; } elseif ($gender == 'F') { $nopic = SKIN_IMAGES_DIR.'female.jpg'; } elseif ($gender == 'D') { $nopic = SKIN_IMAGES_DIR.'director.jpg'; } $img2 = imagecreatefromjpeg($nopic); $ext = 'jpg'; } ob_end_clean(); header("Pragma: public"); header("Content-Type: image/".$ext); header("Content-Transfer-Encoding: binary"); header("Cache-Control: must-revalidate"); $ExpStr = "Expires: " . gmdate("D, d M Y H:i:s", time() - 30) . " GMT"; header($ExpStr); $id = $userid; $dir = str_pad(($id - ($id % 1000))/100000,6,'0',STR_PAD_LEFT); $zimg = USER_IMAGES_DIR.$dir; //header("Content-Disposition: attachment; filename=profile_".$userid."_".$typ.".".$ext); //header("Content-Disposition: attachment; filename=$dir.'/'.profile_".$userid."".$typ.".".$ext); //header("Content-Disposition: attachment; filename=profile"$dir".'/'.".$userid."_".$typ.".".$ext); header("Content-Disposition: attachment; filename=profile_".$userid."_".$typ.".".$ext); /* if ($_SESSION['browser'] != 'MSIE') { header("Content-Disposition: inline" ); } */ if ($ext == 'jpg') { imagejpeg($img2); } elseif ($ext == 'gif') { imagegif($img2); } elseif ($ext == 'png') { imagepng($img2); } elseif ($ext == 'bmp') { imagewbmp($img2); } imagedestroy($img2); ?

    Read the article

  • DataGridView live display of datatable using virtual mode

    - by Chris
    I have a DataGridView that will display records (log entries) from a database. The amount of records that can exist at a time is very large. I would like to use the virtual mode feature of the DataGridView to display a page of data, and to minimize the amount of data that has to be transferred across a network at a given time. Polling for data is out of the question. There will be several clients running at a time, all of which are on the same network and viewing the records. If they all poll for data, the network will run very slowly. The data is read-only to the user; they won't be able to edit any of it, just view it. I need to know when updates occur in the database, and I need to update the screen with those updates accordingly using virtual mode. If a page of data a user is viewing contains data that has change, he/she will see those updates on that page. If updates were made to data in the database, but not in the data the user is viewing, then not much really changes on the user screen (Maybe just the scroll bar if records were added or removed). My current approach is using SQL server change tracking with the sync framework. Each client has a local SQL Server CE instance and database file that is kept in sync with the main database server. I use the information from the synchronization event to see if any changes were made to the main database and were sync'ed to the client. I need to use the DataGridView virtual mode here because I can't have thousands of records loaded into the DataGridView at once, otherwise memory usage goes through the roof. The main challenge right now is knowing how to use virtual mode to provide a seamless experience to the user by allowing them to scroll up and down through the records, and also have records update on the fly without interfering with the user inappropriately. Has anybody dealt with this issue before, and if so, where I can see how they did it? I've gone through some of the MSDN documentation and examples on virtual mode. So far, I haven't found documentation and/or examples on their site that explains how to do what I am trying to accomplish.

    Read the article

  • Copy new records from datatable and identify changes in old records

    - by Betite
    Assume there are two tables: Remote_table and My_table. Remote_table has 6 columns: **PROJECT JOB_TYPE MONTH YEAR** HOURS IS_DELETED 134393 70 1 2013 30 0 134393 70 2 2013 50 0 134393 70 3 2013 80 0 134393 70 10 2012 10 0 134393 70 11 2012 0 0 134393 70 12 2012 15 0 My_table is a copy of remote_table. I tried to copy only the new records from the remote_table by this query: SELECT * FROM [remote_DB].[LudanProjectManager].[dbo].Remote_table EXCEPT SELECT * FROM My_table It works OK but I get a duplicate primary key exception when changes have been made on the remote_table on the hours column. Can anyone think of a way to copy only the new records from remote_table and if changes has been made on old records, to identify them and update the my_table to correspond?

    Read the article

  • How to use SqlDataSource for filling combobox as well as datatable or Dataset

    - by Shantanu Gupta
    I am trying to fetch a column value from a datasource when some value is selected from a dropdownlist on its change event. <asp:DropDownList ID="ddlCityName" runat="server" DataSourceID="dsCity" DataTextField="CityName" DataValueField="CityID" AutoPostBack="True" OnTextChanged="CityName_OnTextChanged"> </asp:DropDownList> <asp:SqlDataSource ID="dsCity" runat="server" ConnectionString="<%$ ConnectionStrings:GmapConnectionString %>" SelectCommand="SELECT * FROM [vcity]" ></asp:SqlDataSource> Here I want to fetch any other column's value that is not binded to a ddlCityName from sqldatasource. I have four columns in datasource i.e. name, id, address, phno. I want to fetch an address of a person who selects some value from ddl.

    Read the article

  • Update rich:dataTable binding on Ajax selectionchange

    - by MilkJug
    I want to find the current selection of the data table whenever a selection changes. I can update other items using: <a4j:ajax render=":tmp,:tmp2" event="selectionchange"> But I cannot find the current selection - I think the major issue is that the UIExtendedDataTable backing does not get updated on the Ajax request. Is there a way to update the current selection on a selectionchange (Using RichFaces 4)?

    Read the article

  • 'cross-referencing' DataTable's

    - by Lee
    I have a DataGridView that is being filled with data from a table. Inside this table is a column called 'group' that has the ID of an individual group in another table. What I would like to do, is when the DataGridView is filled, instead of showing the ID contained in 'group', I'd like it to display the name of the group. Is there some type of VB.net 'magic' that can do this, or do I need to cross-reference the data myself? Here is a breakdown of what the 2 tables look like: table1 id group (this holds the value of column id in table 2) weight last_update table2 id description (this is what I would like to be displayed in the DGV.) BTW - I am using Visual Studio Express.

    Read the article

  • Define classes for a datatable structure - ORM

    - by user424493
    I have existing tables - I have following datatables : ActivityTable(Key ActivityId) - which lists the identifier for various activity ProcessTable (identified by ProcessId) - which lists down which activites(ActivityId) are to be carried out along with their order(StepNum). Some of the activities are marked constant with in a process, that is they will have same data, ir-respective of there run environment. RunTable(Key RunConfigurationId) - that identifies the project name and Process Id Then data for each activity is stored is stored in their individual tables Activity_A, Activity_B,Activity_C so on it uses a combination of RunConfigurationId,ProcessId and stepNum. For the activities which are constant we use a RunConfigurationId= -100. Can anybody help me out how I can map something like this in classes using inheritence regards

    Read the article

  • Order column in a datatable

    - by superartsy
    I have two tables - Parent table (Clients- ClntID,ClntName) And Child Table ( Orders- ClntID,OrderNumber,OrderDate) - Order Number column has a value equal to how many orders the Client has. It is not an autonumber ClntID ClntName 1 Company A 2 Company B ClntID OrderNumber OrderDate 1 1 11/1/2009 1 2 11/15/2009 2 1 2/12/2008 2 1 7/13/2009 If I have a dataset for these tables, how do I insert the data in the Orders table and increment the OrderNumber value correctly.

    Read the article

  • Search in a List<DataRow>?

    - by grady
    Hello, I have a List which I create from a DataTabe which only has one column in it. Lets say the column is called MyColumn. Each element in the list is an object array containing my columns, in this case, only one (MyColumn). Whats the most elegant way to check if that object array contains a certain value? Thanks

    Read the article

  • C# SQL Statement transformed TO LINQ how can i translate this statement to a working linq

    - by BlackTea
    I am having trouble with this I have 3 Data tables i use over and over again which are cached I would like to write a LINQ statement which would do the following is this possible? T-SQL VERSION: SELECT P.[CID],P.[AID] ,B.[AID], B.[Data], B.[Status], B.[Language] FROM MY_TABLE_1 P JOIN ( SELECT A.[AID], A.[Data], A.[Status], A.[Language] FROM MY_TABLE_2 A UNION ALL SELECT B.[AID], B.[Data], B.[Status], B.[Language] FROM MY_TABLE_3 B ) B on P.[AID] = B.[AID] WHERE B.[Language] = 'EN' OR B.[Language] = 'ANY' AND B.STATUS = 1 AND B.[Language] = 'EN' OR B.[Language] = 'ANY' AND B.STATUS = 1 Then i would like it to create a result set of the following Results: |CID|AID|DATA|STATUS|LANGUAGE

    Read the article

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