Sync Services Ado.net SyncSchema - service

I'm trying to build a custom ServerSyncProvider
right now. I'm trying to understand the GetScema Method.
I'm trying to build a dataSet and associate it to SyncSchema class
one of my table columns is a nvarchar(50).
Here is what I'm doing this:
DataColumn column = new DataColumn();
column.ColumnName = "Name";
column.DataType = typeof(String);
column.MaxLength = 55;
table.Columns.Add(column);
But it turns out that on my client side, this column becomes nvarchar(1)
any idea?
Thanks a lot for helping me.

Use this code:
column.ExtendedProperties.Add("ColumnLength", 50);

Related

Suitcrm dynamic drop down

I am tried to create new dynamic drops downs inside suitCRM site using studio . But i can only create drop down with static datas
click on the edit button near drop down list its looks like
i can only add new static values for drop down .
My question is about to create drop down with dynamic values (Eg : fill drop down with lead name and id - all lead names and its ids ) . How it is possible .any help ?
You can do this using customization:
Create one dropdown using studio. e.g. lead_dropdown
You will find entry of dropdown in /custom/include/language/en_us.lang.php
In same file make a database connection as below:
include_once('include/database/DBManagerFactory.php');
$db = DBManagerFactory::getInstance();
$leads = array();
$qryLead = "select a.id, a.name from leads"; $leadRes = $db->query($qryLead);
$leadNum = $db->getRowCount($leadRes); if($leadNum > 0)
{
while ($hrow = $db->fetchByAssoc($leadRes))
{
$leads[$hrow['id']] = $hrow['name'];
}
}
$GLOBALS['app_list_strings']['cl_lead_drodown'] = $leads;
Hope this will help you. Thank you.

SyncFusion to SQL connection and showing on the Dashboard

I just wanted to know whether there is a possibility to connect to the SQL table using SyncFusion, and display the table in the form of a pivot in the Front end. I am using TypeScript for coding. I can also use C# if I need to use. If yes let me know how can I create connection between the SyncFusion and the SQL Table.
Any help on this is appreciated.
Thanks in advance.
Regards,
Raja
The connection to SQL using SyncFusion can be achieved by using the below code snippet.
DataSet ds = new DataSet();
//In below provide full path of your database(*.sdf) location.
string conStringforDB = HttpContext.Current.Server.MapPath("Northwind.sdf").Split(new string[] { "\\wcf" }, StringSplitOptions.None)[0] + "\\Northwind.sdf";
SqlCeConnection con = new SqlCeConnection(conStringforDB);
con.Open();
SqlCeCommand cmd = new SqlCeCommand(#"SELECT Top(100) [Order ID], [Product ID], [Unit Price], Quantity
FROM [Order Details] ", con);
SqlCeDataAdapter da = new SqlCeDataAdapter(cmd);
da.Fill(ds);
//Creation of DataView
DataView dataView = new DataView(ds.Tables[0]);

VB Script in Access Variable not found

So I was advised that I could create some copy replace functionality to this form.
Here is my coding attempt in VB:
First I connect to DB using DAO. Then I use a SELECT statement that has been verified to pull the last record inserted into the DB. Then I try to refill the controls with the values from the query but I am getting reference errors.
Private Sub AutoFill_Click()
Dim db As DAO.Database, rs As DAO.Recordset
Dim strSQL As String
Set db = CurrentDb()
strSQL = "SELECT DISTINCTROW TOP 1 CPOrders.Cust, Customer.NAME, CPOrders.CP_Ref, CPOrders.Slsman, CPOrders.Date_opn, CPOrders.CPSmall, CPOrders.InvIssu, CPOrders.InvNo, CPOrders.InvDate, CPOrders.DueDate, CPOrders.ETADate, CPOrders.Closed, CPOrders.BuyerRef, CPOrders.ToCity, CPOrders.ToState, CPOrders.ToCtry, CPOrders.ToPort, CPOrders.Supplier, CPOrders.Origin, CPOrders.Product, CPOrders.GradeType, CPOrders.NoUnits, CPOrders.Pkg, CPOrders.Qty, CPOrders.TotSale, CPOrders.TotCost, CPOrders.GrMargin, CPOrders.[Sale$/Unit], CPOrders.[Cost$/Unit], CPOrders.OceanCost, CPOrders.OceanNotes, CPOrders.BLadingDate, CPOrders.USAPort, CPOrders.FOBCost, CPOrders.FASExportVal, CPOrders.InlandFrt, CPOrders.CommodCode, CPOrders.Notes FROM Customer INNER JOIN CPOrders ON Customer.[CUST_#] = CPOrders.Cust ORDER BY CPOrders.CP_Ref desc;"
Set rs = db.OpenRecordset(strSQL, dbOpenDynaset, dbReadOnly)
rs.MoveFirst
CP_Ref.ControlSource = rs!CP_Ref
Slsman.ControlSource = rs!Slsman
CPSmall.ControlSource = rs!CPSmall
InvIssu.ControlSource = rs!InvIssu
InvDate.ControlSource = rs!InvDate
DueDate.ControlSource = rs!DueDate
Closed.ControlSource = rs!Closed
rs.Close
db.Close
The control source reference picks up and autocompletes the word.
I would think that as it stands. although i'm not filling all the values with records from my SELECT statement that it would populate but instead i get things like #NAME? where the values should be. I also get a break in my code and it says "Invalid use of null"
Why? I appreciate your guys input and I can provider screenshots if necessary. I think this is involving the reference tie, but I'm not sure. Any help is much appreciated.
You are using the field names from the SELECT statement as if they were variables.
CP_Ref.ControlSource = rs("CP_Ref")
Slsman.ControlSource = rs("Slsman")
CPSmall.ControlSource = rs("CPSmall")
InvIssu.ControlSource = rs("InvIssu")
InvDate.ControlSource = rs("InvDate")
DueDate.ControlSource = rs("DueDate")
Closed.ControlSource = rs("Closed")
When you have that worked out, tackle the "Invalid use of null" problem by first identifying any fields that could potentially be NULL and using something like
SELECT Iif(IsNull([InvDate]), '', [InvDate]) As [InvDate], ...
in the SELECT statement to pass across a minimum of an empty string rather than a NULL value.

jasper reports table creation

I would like to create a table in my Jasper Report.
This could be done (and it is done :-) ) in iReport, but the content of the table (for example names of the columns) are changing, so I would like to create the report solely from JAVA code (by not using jrxml files).
How is it possible?
So far, this is what I have done (the main parts only):
//table component
final StandardTable table = new StandardTable();
final StandardColumn col1 = new StandardColumn();
final DesignCell col1Header = new DesignCell();
final JRDesignStaticText textElement = new JRDesignStaticText();
col1Header.addElement(textElement);
col1.setDetailCell(col1Header);
table.addColumn(col1);
/datasource
final JRDesignDatasetParameter param = new JRDesignDatasetParameter();
param.setName("REPORT_DATA_SOURCE");
final JRDesignExpression exp = new JRDesignExpression("$P{REPORT_DATA_SOURCE}");
param.setExpression(exp);
//datasetrun
final JRDesignDatasetRun drs = new JRDesignDatasetRun();
table.setDatasetRun(drs);
drs.addParameter( param );
How to continue?
Thank you,
krisy
In case anyone stumbles upon the same problem (and for future myself :-) ) here is how to continue the code above, to add a table element to the summary of the report:
//create reportElement (inside componentelement)
JRDesignComponentElement reportElem = new JRDesignComponentElement();
//reportElem.setKey("table");
reportElem.setComponentKey(new ComponentKey("http://jasperreports.sourceforge.net/jasperreports/components", "jr", "table"));
reportElem.setComponent(table);
reportElem.setHeight(100);
reportElem.setWidth(100);
//add to summary
jRSummary.addElement(reportElem);
(the hard part was to find out how to create the ComponentKey object)
Note: in order to use the table, the subdataset element needs to be created as well.
For htmlComponent the ComponentKey should be:
new ComponentKey("http://jasperreports.sourceforge.net/htmlcomponent", "jr",
"html");

how to delete findDependentRowset result in Zend Framework

I have place model & entry model that entry is parent
everything is fine but how can I delete the result row $categoryPlacements
in place model:
$entryModel = new Model_EntryModel();
$entryRow = $entryModel->find ( $entryId )->current ();
$categoryPlacements = $entryRow->findDependentRowset($this);
in this case i want to delete the $categoryPlacements result in place model
I can use categoryPlacements->toarray() and then delete but is another easy way?
Foering Keys at the database could solve this issue.
$categoryPlacements = $entryRow->findDependentRowset($this);
foreach ($categoryPlacements as $placement){
$where = $db->getAdapter()->quoteInto('id = ?',$placement->id);
$db->delete($where);
}
Sorry if this is not what you need, regardĀ“s.