PDA

View Full Version : Just downloaded Ext Designer ( how to connect to SqlExpress database )



lipkinrm
6 Aug 2010, 12:03 PM
To All

I am in the process of evaluating several AJAX IDE's and have been told ExtJS ( now Sencha ) is one of the best platforms for rapid Web rich Gui applications.

This is my first day and I have previewed several different vendors and the most difficult part of any java\ajax application is getting to the actual data.

In my case I use SQLServer Express 2008 and I have asp.net loaded on my box ( windows 7 and iis7 ) .. Does anyone know how I can successfully create a server side json or xml routine to create a 'datastore' and attach it to a form or grid ..

I would truly like to know how to bring real information into my evaluation and try to build a menu system, grid and drill down dialog system to prove that a rich web application can be as appealing as a wingui application.

I am looking for some advice and a couple of examples on Sql Server, connectivity and how to use it as a datastore in the EXT designer ..

Thanks

Rick Lipkin
r1.1955@live.com
803-404-1805 cell

Columbia, SC USA

mystix
9 Aug 2010, 8:35 AM
[ moved to Ext.Designer help forum ]

jarrednicholls
9 Aug 2010, 10:28 AM
Hi Rick,

May I first inquire as to what .NET version you are using? I ask because if you are using 3.5+, there is a native JSON serializer class (http://msdn.microsoft.com/en-us/library/system.web.script.serialization.javascriptserializer.aspx) that will serialize any object, whether it's a strongly-defined type or an anonymous type. The first step after retrieving your data from the database is to serialize it into a format accepted by one of the Ext.data.DataReader types. JSON and XML are the two most popular formats...and I personally recommend JSON, particularly since the JavaScriptSerializer class does such a fantastic job of serializing in .NET.

Let me know what .NET runtime you're running on, and I can provide an example for you based on that. If you are restricted to 2.0, then you need a third-party JSON serializer.

Thanks,
Jarred

lipkinrm
11 Aug 2010, 10:41 AM
Jarrad

I am using asp.net 4.0 that came with the trial version of VS 2010 .. as well as the latest .net 4x .. The problem I have is being able to connect and extract any data from my SQLExpress database on my local development box .. I eventually want to bring the data into xml or json .. but I have no clue how to do that and I am hoping you have a solution .. I am very new at this and used to going out .. connecting to a database and referencing a recordset for what I need.

Here is an .asp routine that I was trying to work with to create an xml file .. not been very successful .. plus I will probably get some active x browser warnings ..

Any suggestions you can make I would be mose grateful .. I have also downloaded the jdbc driver for sql server .. not having much luck with that either ..

Rick Lipkin
r1.1955@live.com

Response.ContentType = "text/xml"
Response.Write("<NewDataSet>")
Response.Write("<xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">")
Response.Write("<xs:element name="NewDataSet" msdata:IsDataSet="true">")
Response.Write("<xs:complexType>")
Response.Write("<xs:choice maxOccurs="unbounded">")
Response.Write("<xs:element name="Table">")
Response.Write("<xs:complexType>")
Response.Write("<xs:sequence>")
Response.Write("<xs:element name="CategoryID" type="xs:string" minOccurs="0" />")
Response.Write("<xs:element name="CategoryName" type="xs:string" minOccurs="0" />")
Response.Write("<xs:element name="Description" type="xs:string" minOccurs="0" />")
Response.Write("</xs:sequence>")
Response.Write("</xs:complexType>")
Response.Write("</xs:element>")
Response.Write("</xs:choice>")
Response.Write("</xs:complexType>")
Response.Write("</xs:element>")
Response.Write("</xs:schema>")
Set con = Server.CreateObject("ADODB.Connection")
Set rs = Server.CreateObject("ADODB.Recordset")
con.Open "Provider=SQLOLEDB;Data Source=RICKLIPKIN-PC\SQLEXPRESS;Initial Catalog=VEHICLE;User Id=vehicleuser;Password=lipkinrm"
strSQL = "SELECT * from AGENCY"
rs.Open strSQL, con
While NOT rs.EOF
Response.Write("<Table>");
Response.Write("<CategoryID>"+rs(0)+"</CategoryID>")
Response.Write("<CategoryName>+rs.getString("agency")+"</CategoryName>")
Response.Write("<Description>"+rs(4)+"</Description>")
Response.Write("</Table>";
rs.MoveNext()
Wend
rs.Close()
con.Close()
%>
</NewDataSet>

jarrednicholls
12 Aug 2010, 11:43 AM
Hey Rick,

It sounds like you need some more assistance on the server-side of things. Have you dug into some learning material on ASP.NET and C#? There is a pretty good Wrox book out for the latest version of ASP.NET: http://www.amazon.com/gp/product/0470502215?ie=UTF8&tag=aspnettelligent-20&linkCode=as2&camp=1789&creative=9325&creativeASIN=0470502215 I cannot comment on it personally but based on the subject matter in the book and customer reviews, it looks like a winner. I'd definitely recommend learning more in detail about the System.Data namespace, and perhaps even System.Linq and LINQ to SQL for really easy data access. Check into it, you'll really like it and it will make data access a snap. When you are comfortable with that, I can help you turn your data results into the proper JSON that's compatible with the Ext JS JsonStore (or into xml for the XmlStore respectively).

Best of luck!

lipkinrm
13 Aug 2010, 11:03 AM
Jarred

I did just today order the book you suggest .. I do have VS 2010 trial version for an extended time but have never been impressed with MS in creating rich GUI applications.

I have been evaluating EXT js and Bindows and the same problem of connecting to my sqlexpress 2008 database seems to be the show stopper. All I need is someone to see if they could provide me a way to connect and extract my data to xml ( or json ) and then load it into a grid or dialog ..

Without being able to query data .. I am stuck ..

Thanks
Rick Lipkin

ssamayoa
13 Aug 2010, 12:56 PM
Hi lipkinrm.

All RIA technologies (Flex, Silverligth, WebGUI, LAZLO, ExtJS, etc.) needs backend server based data services.
AFAIK none of then are "plug & play" as you could do with ASP.NET page and SQLServer or Winfors and SQL Server with the exception of WebGUI which emulates WinForms with JavaScript or Silverligth but let me tell you that I abbandoned it becuase is too chaty and, even if it works, is a hacked use of winforms designer.

Dont be defeated nor hounted by the task at firts.

I dont remeber the equivalent of Java Servlet in ASP.NET but I wrote one for a proof of concept very easy when I were evaluating ExrJS. It took me less than an hour but, of course, I have 10+ years developing with Java. Now I have various servlets for raw database table access (ex: www.somedomain.com/someapp/tableprovider/read/CUSTOMERS?start=50&limit=50...) and pre defined queries (www.somedomain.com/someapp/queryprovider/read/customersByName) which react to pagination and ux filtering. Such code can do CRUD which Im using now for a new application in ExtJS.

So, you have two options:

1. Learn ASP.NET and ADO.NET and design and implement your data access strategy.
2. Pay to someone with experience who can write the provider for you.

Now Im too busy with my own projects but if you are interested in #2 lets talk: I could convert my java code to ASP.NET/ADO.NET.

Regards.

ssamayoa
13 Aug 2010, 12:59 PM
Response.ContentType = "text/xml"
Response.Write("<NewDataSet>")
Response.Write("<xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">")

By the way, JSON is more simpler and use less bandwith than XML.

Regards.

evant
13 Aug 2010, 9:22 PM
http://www.sencha.com/forum/showthread.php?68161-Ext.Direct-.NET-Router

You might find this useful. Not related to the designer, but it shows a method of consuming server side data from different data sources (xml, sqlite)

lipkinrm
14 Aug 2010, 10:03 AM
ssamayoa

I am definitly getting discouraged .. I finally got my asp code working to open a sql database and then run the recordset thru an xml loop .. however .. I found much of my data has / forward slashes in it and it causes my xml to blow up .. I would definitly be interested in your second option .. I have NO java experience and I realize I am at a serious dis-advantage .. however .. the forms and grid ( control ) side of things I am not to worried about .. it is just managing and handling the data that seems to give me so much grief .. Please send me an e-mail and we can discuss this privatly ..

Thanks
Rick Lipkin
r1.1955@live.com

evant
15 Aug 2010, 3:13 AM
I don't know why you think having experience with Java is somehow a disadvantage. Ext will work with ~any~ server side platform.

Perhaps you're not overly familiar with this kind of web development, but as I said above, you should check out the link I posted above which shows working examples of consuming server side data with .NET using Ext.

lipkinrm
15 Aug 2010, 8:00 AM
Evan

I downloaded your router 1.0 code .. I have briefly looked at it and I am a bit overwhelmed .. I am just now picking up .net and have downloaded the vs 2010 demo .. I have ordered the book 'Beginning ASP.NET 4: in C#' and will work thru the examples .. right now I just do not have any familiarity with .net web development as you mention ..

Thank you for your help !! ..

Rick Lipkin
r1.1955@live.com

ssamayoa
16 Aug 2010, 8:00 AM
Nice work but too complex for newcommers.

After a lot of tries on making my developers true "object-oriented" I discovered that they are more comfortable and productive with relational model. So I decided that less tiers between the front-end and back-end (database) is the way to go. Dont get me wrong, I really like the idea of Direct, object persistence, context and dependency injection, etc. but the abstraction level it requires is overhelming to new or mid seasoned application developers.

Regards.

evant
17 Aug 2010, 12:43 AM
That's not really the case at all. Taking the example of the .NET router, all you need to do is create a C# class, mark some methods with a few attributes and then you can call them from the client. That's it. You don't need to know how it all works under the hood. Direct doesn't have anything to do with object persistence or dependency injection. If you have another look you'll see it's quite trivial to get working.

ssamayoa
17 Aug 2010, 5:05 AM
"all you need to do is create a C# class, mark some methods with a few attributes and then you can call them from the client"

You miss the point of simplicity: Annotations/Attributes are simple but almost all times have a lot of abstraction behind it. The method must do all the stuff and create some sort of DTO list or response JSO or XML. People need stuffed things to get started quick. Do you use sometime Delphi or VB? Thats the tools average developers can use in which you do the data access stuff using components and wizards.

Regards.

jarrednicholls
17 Aug 2010, 6:04 AM
I find using UI wizards for data access and Ext.Direct completely separate issues and conversations ;-) General data access and Ext.Direct are not related whatsoever...Ext.Direct is a communication protocol, not a data access protocol.

Regards,
Jarred

evant
17 Aug 2010, 6:17 AM
You miss the point of simplicity: Annotations/Attributes are simple but almost all times have a lot of abstraction behind it.


Absolutely. Perhaps new users shouldn't use the Designer or ExtJS at all, because it abstracts so much away ;) As @jarrednicholls said, this is way off topic, if you'd like to discuss it further via PM, feel free.

ssamayoa
17 Aug 2010, 6:24 AM
I find using UI wizards for data access and Ext.Direct completely separate issues and conversations ;-) General data access and Ext.Direct are not related whatsoever...Ext.Direct is a communication protocol, not a data access protocol.


Yep, totally agree but to get more extjs adoption may be sencha should spend some resources to develop basic CRUD server code in main languages (php, .NET, Java) to show newcommers how to do that but what we said in spanish "al hueso": with very few abstraction or not at all.

Regards.

ssamayoa
17 Aug 2010, 6:25 AM
Absolutely. Perhaps new users shouldn't use the Designer or ExtJS at all, because it abstracts so much away ;)

Agree.

Regards.

fgeorge
20 Aug 2010, 8:24 AM
why dont you try outputting json data using ASP. NET MVC?

You can use JsonResult to output pure JSON instead of jumping through hoops trying to get web services output JSON.

Its much easier.

ssamayoa
20 Aug 2010, 8:58 AM
Full CRUD example using MVC would be nice.

I will insist in what I already said: To get more extjs adoption may be sencha should spend some resources to develop basic CRUD server code in main languages (php, .NET, Java) to show newcommers how to do that but what we said in spanish "al hueso": with very few abstraction or not at all.

Regards.