Data-grid population problems
Hi,
I am having a little problem that is driving me mad . When trying to fill my data-grid noting happens . No error or noting . The only thing i can see is when i run the application a red x is put on my database in the server explorer and when i refresh it
it will return to normal.
Any help would be appreciated.
Thanks.
private void btnSearch_Click(object sender, EventArgs e)
searchAll();
public void searchAll()
OleDbConnection conToDataBase = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\Resources\health_plus.accdb;Persist Security Info=True");
OleDbCommand searchAllCom = new OleDbCommand("SELECT * FROM Doctors", conToDataBase);
conToDataBase.Open();
searchAllCom.CommandType = CommandType.Text;
OleDbDataAdapter searchDocAdapter = new OleDbDataAdapter(searchAllCom);
DataTable doctorsTable = new DataTable();
searchDocAdapter.Fill(doctorsTable);
searchDoctorDataGrid.DataSource = doctorsTable;
Hi Ali-k,
First you need to make sure the data is in your Access DataBase.
Then If you have binded the DataSource before searchAll method, you could clear the DataSource before resetting it like below.
searchDocAdapter.Fill(doctorsTable);
searchDoctorDataGrid.DataSource = null;
searchDoctorDataGrid.DataSource = doctorsTable;
If you have any other concern regarding this issue, please feel free to let me know.
Best regards,
Youjun Tang
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.
Similar Messages
-
Hi All,
When I use Action Script to create DataGrid, the selection
line cannot be changed in mouse click event. But the
dg.selectedIndex has be changed correct row, only the selection
line is no change.
My sample code as follow:
var dg:DataGrid = new DataGrid()
dg.selectable = true;
var cols:Array = new Array();
var col1:DataGridColumn = new DataGridColumn();
col1.dataField = "col1";
var col2:DataGridColumn = new DataGridColumn();
col2.dataField = "col2";
cols.push(col1);
cols.push(col2);
dg.columns = cols;
var row1:Object = new Object();
var row2:Object = new Object();
var row3:Object = new Object();
var row4:Object = new Object();
var rows:Array = new Array();
rows.push(row1);
rows.push(row2);
rows.push(row3);
rows.push(row4);
dg.dataProvider = rows;
The selection line always hold on last row, how to solve it
let the selection line can follow the selectedIndex to change?
ThanksThe function code is: &F03
alternativley I already tried BACK with the same result.
Where shall I put the LEAVE TO SCREEN 0 when it's using the standard PAI Module which is NOT included within my Report? -
Problem rendering a combo box in the data grid
Hi,
I am rendering a combo box in the data grid control using an
item renderer. When I click on it to select a value from the drop
down, the combo box immediately closes giving no time to even click
on the dropdown. This doesn’t happen every time the combo is
clicked, although it happens frequently. What I think is that the
problem arises because the data grid tries to refresh the renderers
and during this process, the existing combo is removed, thereby
getting closed automatically. Please let me know of a work around.
Thanks,
Chereehi hiwa,
i have to add combo box in datagrid dynamically.
it should append as and when i add the data in the above text boxes.
thanks in advance. -
Hi All,
Account calculations are not displaying on the data grid. But the values are being picked up with a smart view report.
I tried running a force calculate and a consolidate all, but that did not work.
Please suggest in this regards.
Thanks in advance....I tried to use your algorithm to modify my code but i am not able to do that. For this example i am not using any httpservice i am using data services. I created a PHP file i just need to import it into data services planel and drag that services onto data grid it will automatically bring all the data into that data grid. Can you tell me what i need to modify to achive my goal. am using following code
protected function dataGrid_creationCompleteHandler(event:FlexEvent):void
getHorizontalCommentResult.token = horizontalCommentsService.getHorizontalComment();
<mx:DataGrid x="159" y="123" id="dataGrid" creationComplete="dataGrid_creationCompleteHandler(event)" dataProvider="{getHorizontalCommentResult.lastResult}" height="223" width="245">
<mx:columns>
<mx:DataGridColumn headerText="Comments" dataField="Comments"/>
</mx:columns>
PP file
<?php
class HorizontalCommentsService{
public function getHorizontalComment() {
$connection = mysqli_connect("localhost", "root", "root", "my_db", 8889) or die(mysqli_connect_error());
$sql = "SELECT * FROM photo_comments ORDER BY Image_ID DESC";
$result = mysqli_query($connection, $sql) or die('Query Failed: ' . mysql_error($connection));
$rows = array();
while($row = mysqli_fetch_object($result)) {
$rows[ ] = $row;
return $rows;
?> -
OK I think that is resolved but I cannot pull the Data.
The Grid does not populate with data......Just keeps trying to pull it.
THE CFC FUNCTION:
<cffunction name="comments" access="remote" returntype="struct">
<cfargument name="page" required="true">
<cfargument name="pageSize" required="true">
<cfargument name="gridsortcolumn" required="true">
<cfargument name="gridsortdirection" required="true">
<cfquery name="selectAll" datasource="#dsn#" dbtype="#i#">
SELECT autoid, CONVERT(VARCHAR(10), sDate, 101) as sDATE, DAGRSN, branch,
DODAAC, clin, hours
FROM reporting.DAGRSCRAPS
</cfquery>
<cfreturn queryconvertforgrid(selectAll,page,pagesize)/>
</cffunction>
THE DATA GRID ITSELF:
<cfform name="myform" id="myformid">
<cfgrid
name = "myGrid"
format="html"
bindOnLoad="yes"
bind="cfc:pdgps.admin.backoffice.components.Data.comments({cfgridpage },{cfgridpagesize},{cfgridsortcolumn},{cfgridsortdirection})"
pageSize="10"
preservePageOnSort="true"
selectMode="single"
selectOnLoad="no"
font="Verdana"
fontsize="11"
label="True"
stripeRows="true"
stripeRowColor="##D9CCFF"
selectColor="##994FE6">
<cfgridcolumn name="autoid" display="no" >
<cfgridcolumn name="branch" header="SERVICE" type="string_noCase" >
<cfgridcolumn name="DODAAC" header="DODAAC" type="string_noCase" >
<cfgridcolumn name="DAGRSN" italic="yes" display="yes" header="DAGRSN">
<cfgridcolumn name="sDATE" display="yes" header="Date" mask="EEE DD-MMM-YY H:NN A">
<cfgridcolumn name="clin" width="35" display="yes" >
</cfgrid>
</cfform><cfargument name="gridsortdirection" required="true">
<cfset var selectAll = "">
<!--- this 'var' scopes the selectAll variable to be local to this function --->
<cfquery name="selectAll" datasource="#dsn#" dbtype="#i#">
Also, where are the 'dsn' and 'i' variables defined. They do not appear to be part of this function. Using a CFC function remotely has a great effect on what variables scopes may or may not be accessed. -
Flashing Problem in advance data grid
I am using advancedatagrid and make 4 level tree based menu using bindable data priovider, Please see the screenshot
I define own item render in each level of advance data grid in appliction, but i have flashing issue here, when i update the downloading percantage then image flickring in the list.
Please give the best solution to avoid the flashing....
Thanks
AneesHi,
while preparing internal table to be passed to ALV, you have to implement the logic for these scenarios.
Regards,
Raghavendra -
How to change enter key behavior in data grid view?
Greetings community
I have a simple problem. I have a table of several columns, and I want it to be editable without using a mouse. I want user to enter value in the first column, press enter key on keyboard, enter value in second column, press enter key,
and so on. I want data grid view to open another row only when all columns in the working row are populated. However, pressing the enter key causes opening new row whenever user presses the enter key.
I tried to set current cell of data grid view in CellValueChanged event , but it didn’t work. Actually, it really moves current cell where I want, but after that it moves it one row down.
I traced the execution of code, and counted CurrentCellChanged events to see what happens.
Does anyone know if there’s any way to suppress this behavior?
Thanks in advanceGreetings community
I have a simple problem. I have a table of several columns, and I want it to be editable without using a mouse. I want user to enter value in the first column, press enter key on keyboard, enter value in second column, press enter key,
and so on. I want data grid view to open another row only when all columns in the working row are populated. However, pressing the enter key causes opening new row whenever user presses the enter key.
I tried to set current cell of data grid view in CellValueChanged event , but it didn’t work. Actually, it really moves current cell where I want, but after that it moves it one row down.
I traced the execution of code, and counted CurrentCellChanged events to see what happens.
Does anyone know if there’s any way to suppress this behavior?
Thanks in advance
Hello,
It perhaps be better using Tab key which is exactly used for switch focus to the next cell instead of dealing with enter key.
Regards,
Carl
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Issues with Data Grid Combo Boxes
Hi,
I am trying to implement, 3 combo boxes for each row in extended data grid but unable to find the solution. Can someone please help?
Problem in detail:
The issue is after populating the data grid i want to give users 3 options using 3 combo boxes(i.e each row in data grid will now have 3 options , which is basically converting 1 row into 3 rows with 3 options),so that they are able to do their computations.
This is reallly urgent, any help would be highly appreciated.
Thanks & Regards
Pankaj"In this new release of SQL Dev, when I execute a SQL in the SQL Worksheet and click in the Data Grid in the Results tab and try to navigate within a record using arrow keys, the grid cell enters into edit mode by default and so I cannot use the Left or Right arrow keys to navigate the grid. I am forced to use tab key to navigate. This is counter intuitive in my opinion."
In the "Results" tab, Click Ctrl & Tab keys (at the same time) or with mouse click on any cell other than the first column (a sequence or rownum), you will be able to navigate using the arrow keys.
"Another issue that I have come across is with SQL syntax checking. In some cases, when I press F9 to execute a SQL, it shows the SQL as executed i.e. shows something like 0.0134 seconds in the toolbar and no results displayed. In reality, the SQL had some syntax error which were NOT reported. This can be frustrating since now I have to fall back to SQL*Plus or TOAD just for syntax check."
The 0.0134 seconds could be the result of the most recently executed successful statement. Check the Script Output tab for errors. Use F5 (Run Script option) instead of F9.
"I like the fact that SQLDev highlights the current SQL but it would be more useful if it just indicated the first line of the current sql instead of highlighting the whole sql."
On the SQL statement (or code), Right Click -> Format SQL (or press Ctrl & B), proper formatting would help.
I use version 1.0.0.15.57 and seems to be working allright.
- Babu Rangasamy -
Hi there,
I am a beginner in Visual Basic Express 2010. I have a Point of Sale program that uses DataGridView to display records from an external microsoft access
database using the fillby query.
It works, but it repopulates the same row each time, but i want to be able to display multiple records at the same time, a new row should be filled for
each click of the fillby button.
also I want to be able to delete any records if the customer suddenly decides to not buy an item after it has already been entered.
so actually 2 questions here:
1. how to populate a new row for each click of the fillby button
2. how to delete records from data grid view after an item has been entered
Thanks
VishwasHello,
The FillBy method loads data according to what the results are from the SELECT statement, so if there is one row then you get one row in the DataGridView, have two rows then two rows show up.
Some examples
Form load populates our dataset with all data as it was defined with a plain SELECT statement. Button1 loads via a query I created after the fact to filter on a column, the next button adds a new row to the existing data. When adding a new row it is appended
to the current data displayed and the primary key is a negative value but the new key is shown after pressing the save button on the BindingNavigator or there are other ways to get the new key by manually adding the row to the backend table bypassing the Adapter.
The following article with code shows this but does not address adapters.
Conceptually speaking the code in the second code block shows how to get the new key
Public Class Form1
Private Sub StudentsBindingNavigatorSaveItem_Click(
sender As Object, e As EventArgs) Handles StudentsBindingNavigatorSaveItem.Click
Me.Validate()
Me.StudentsBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.MyDataSet)
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'MyDataSet.Students' table. You can move, or remove it, as needed.
Me.StudentsTableAdapter.Fill(Me.MyDataSet.Students)
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Me.StudentsTableAdapter.FillBy(Me.MyDataSet.Students, ComboBox1.Text)
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Me.MyDataSet.Students.AddStudentsRow("Jane", "Adams", "Female")
End Sub
End Class
Get new key taken from
this article.
Public Function AddNewRow(ByVal sender As Customer, ByRef Identfier As Integer) As Boolean
Dim Success As Boolean = True
Try
Using cn As New OleDb.OleDbConnection With {.ConnectionString = Builder.ConnectionString}
Using cmd As New OleDb.OleDbCommand With {.Connection = cn}
cmd.CommandText = InsertStatement
cmd.Parameters.AddWithValue("@CompanyName", sender.CompanyName)
cmd.Parameters.AddWithValue("@ContactName", sender.ContactName)
cmd.Parameters.AddWithValue("@ContactTitle", sender.ContactTitle)
cn.Open()
cmd.ExecuteNonQuery()
cmd.CommandText = "Select @@Identity"
Identfier = CInt(cmd.ExecuteScalar)
End Using
End Using
Catch ex As Exception
Success = False
End Try
Return Success
End Function
In closing I have not given you a solution but hopefully given you some stuff/logic to assist with this issue, if not perhaps I missed what you want conceptually speaking.
Additional resources
http://msdn.microsoft.com/en-us/library/fxsa23t6.aspx
Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. -
Hello,
I have to display into a data grid, in Flex 2, 2 columns:
first column ( "Images") must contain a picture with an object and
second column (" quantity") must contain the amount of that object
that I want to buy. The problem is that I must take the name of the
image from an .xml file, specified like this:
<mx:DataGrid id="obj" dataProvider="{ObjList}" > where
ObjList is the .xml file with <name/>
<picture_address/> etc.
The second column must contain a textbox so I can input a
number of items for each picture ( can be also a combobox where
from I can select some value, from 1 to 20 for example).
I've searched the Internet and I haven't found a solution
yet. Please give me a link or a solution for this problem.
Tudoruse itemrenderes.... the example below shows how to add an
image.... you can do the same thing with a text box or combo box
<mx:DataGridColumn width="10" headerText="Image">
<mx:itemRenderer>
<mx:Component>
<mx:Canvas width="100%" height="100%">
<mx:Image verticalCenter="0" horizontalCenter="0"
source="{data.picture_adress}""/>
</mx:Canvas>
</mx:Component>
</mx:itemRenderer> -
How do I take data from a data grid and put it into a variable?
I am having problems taking data from a datagrid (guess you got that from the title) and setting it to a variable. I am tak
ing the data from 3 different rss feeds, depending on what button you press, and showing it in a grid. I would like to be able to do more with this data. Here is my code so far:
<mx:VBox id="vbox" x="70" y="150">
<mx:Label text="This Data Grid is doing nothing" />
<mx:DataGrid width="1000" dataProvider="{fullXML}">
<mx:columns>
<mx:DataGridColumn id="dataGrid" *dataField="channel.description" headerText="Feed"/>
</mx:columns>
</mx:DataGrid>
</mx:VBox>
<!-- from test 5 -->
<mx:Move id="moved" target="{hbox}" repeatCount="0" easingFunction="mx.effects.easing.Linear.easeIn" />
<mx:HBox id="hbox" fontSize="12" fontFamily="courier">
<mx:Label text="{website**}" />
</mx:HBox>
* this is the data I want to get out
** this is where I want to be able to put the variable.
I don't know if I can do it here or if I need a function or what.
I would like to be able to put it into an array, but step one is anything at all, so I'm trying just a variable.Where do I put that line of code? I see that it goes at the Script part near the top, but how can I use that, I am pretty new to this language. I am not familiar with this line, where does it bind the value from the datagrid to the variable?
fullXML[myDataGrid.selectedIndex].FIELD_NAME;
myDataGrid would be the id from the grid I am guessing?
and selected index would be the channel.description part?
and FIELD_NAME; is the variable name?
does this go into a funtion or is it placed at the top where the variables are declared? -
Update one row at a time, Data Grid
Is it possible to update one row of a mx:DataGrid at a time. I want to be able to have a user push a button and info populates one row of the data grid, user changes some properties and pushes the button again and another row of values populate the DataGrid. Everything I see does a mass population from an XML or what have you.
ThanksI did this this to work, so for those of you who may find this info helpfull here is how I solved the issue.
I instantiated an ArrayCollection object like so:
private var _rowValues:ArrayCollection = new ArrayCollection();
I simply referenced the .addItem() property of my ArrayCollection.
I then added values to the ArrayCollection as follows
_rowValues.addItem({Ingredient:ingredient, Amount:amount, Category:category}); //dataField:value
and referenced the dataField proerpty of the DataGrid... so in my case my 3 dataField properties (in my mxml compontent) were as fillows:
dataField="Ingredient"
dataField="Amount"
dataField="Category"
all done, and it works. -
My custom Tool tip on spark data Grid don't work ?
I want to add panel component as my tooltip for each row in my Spark DataGrid. So when mouse rollover the user can see the information for each the ship. I want a panel as my tooltip for dataGrid cause I want to organize my data neatly and also place a image in the panel.
I came across :http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf60d65-7ff6.html where they show an example of "Implementing the IToolTip interface" using the panel.I tried manipulating the codes but it didt work for my spark dataGrid.
So my question :
Can some one pls show me how I can use the Panel as my tool tip for each row in spark data grid.
I have been struggling for quite some time.If possible pls Give me an example.
This is my codes below (I tried to follow the example from :http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf60d65-7ff6.html#WS2d b454920e96a9e51e63e3d11c0bf60d65-7ff4 -"Implementing the IToolTip interface")
My MXML Application codes :
<fx:Script>
<![CDATA[
import DesignItemRenderer.PanelToolTip;
import mx.events.ToolTipEvent;
import mx.collections.ArrayCollection;
import mx.controls.Alert;
import spark.events.GridEvent;
[Bindable]
private var myArrivalShips:ArrayCollection = new ArrayCollection([
{arrivalShipsName:"Ship A", ETD:"12 March"},
{arrivalShipsName:"Ship B", ETD:"25 March"}
private function createCustomTip(event:ToolTipEvent):void {
var ptt:PanelToolTip = new PanelToolTip();
ptt.title = "my Ship Info";
ptt.bodyText = "my data for the ship";
event.toolTip = ptt;
]]>
</fx:Script>
<s:BorderContainer x="267" y="11" width="331" height="586">
<s:DataGrid id="arrivalTable" x="10" y="326" width="302" height="205" requestedRowCount="4" dataProvider="{myArrivalShips}" toolTipCreate="createCustomTip(event)">
<s:columns>
<s:ArrayList>
<s:GridColumn dataField="arrivalShipsName" headerText="Arrival Ships" ></s:GridColumn>
<s:GridColumn dataField="ETD" headerText="ETD"></s:GridColumn>
</s:ArrayList>
</s:columns>
</s:DataGrid>
<s:BorderContainer x="10" y="19" width="302" height="285">
</s:BorderContainer>
</s:BorderContainer>
My Custom Panel codes :
<s:Panel xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" width="400" height="300"
implements="mx.core.IToolTip" >
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<fx:Script>
<![CDATA[
[Bindable]
public var bodyText:String = "";
// Implement required methods of the IToolTip interface; these
// methods are not used in this example, though.
public var _text:String;
public function get text():String {
return _text;
public function set text(value:String):void {
]]>
</fx:Script>
<s:RichText text="{bodyText}" percentWidth="100"/>
</s:Panel>Ok I was getting ready to post the renderer code and then found the problem. I had copied this code from another renderer which had contentBackgroundAlpha=0 in the MXAdvancedDataGridItemRenderer tag. When I removed it, the style of the TextArea worked as intended. Your comment helped me to take a closer look at the renderer code, so thank you.
-
Text in data grids doesn't display
With the new 29 version of FireFox, data grids on our site don't seem to display the data in the grids any longer. When using Chrome or IE11, these still show just fine. Version 28 and earlier worked great. The menu system in our site doesn't work well any longer either using version 29.
What we are seeing on this site was also seen with IE11 when it first came out but that was easily fixed by just using the "compatability" settings in IE11 and adding our site to the list of compatible sites. There isn't such a setting in FireFox so I wonder how we go about getting around this.Thanks for the offer but we no part of this site can be publicly accessed. The thought of a font causing the problem doesn't make much sense to me because it was working fine prior to version 29. Why would the font all of a sudden be causing the problem. Furthermore, it isn't just text in data grids but the menu system we use doesn't work properly either. You have to hold down on the left mouse button to use the menu and then when you are on the item you want to select, let off the left mouse button. Guess our only option is to start recommending Chrome or IE.
-
EXPORT FLEX DATA GRID DATA TO EXCEL
I want to export the datagrid data into excel.
Does any one have solution.
GopiProbably not the answer you want to hear... I have my
datagrid grid populating by an HTTPService exposed through
mod_perl, that returns XML data. I created a little button to
export to CSV for each table, have that use navigateToURL(...) to
popup a new window where the url is the address of another Perl
service that returns the same data as a .csv attachment (set
through HTTP headers).
I can send your clearer instructions on this if it is
something you'd want to follow through on. If there is a cleaner
solution, I'd also like to hear about it...
Jason
Maybe you are looking for
-
ITunes 9.1 not sorting artists correctly
Just upgraded iTunes on Win7 PC to 9.1 and seem to have a problem with sorting on the Artist. I have a large (2800 CDs + various downloads) collection, with a lot of jazz - so quite a lot of music where the artist name is not a band name but a person
-
Style sheet changes not appearing in RH10
Hello all, Searching for an answer before I posted, I saw this question from a member named Pam about RH11 posted almost a year ago, but I don't see an answer. I'm hoping there is an answer! After many years of working in RoboHelp and carrying on wit
-
Oracle 10g release 2 patch set 3
Oracle 10g release 2 patch set 3 is for 10.2.0.4. Can this patch be applied to Oracle enterprise 10.2.0.3? Thanks.
-
Hi, I'm trying to run JMSAppender i have a few questions. First is related with MDB. I deployed it on Oracle9iAS this kind of mdb: <message-driven > <description><![CDATA[]]></description> <display-name>iateLogginMDB</display-name> <ejb-name>iateLogg
-
Alerts from KPI (Performance Point)
Hi I have installed Performance Point Monitoring Server. Is there anyway, i can set up alerts from KPI.Can some body give me some link having detailed information about setting up alertsalerts? Thanks Deeps