Hi
In my opinion, this issue should have nothing with the DbConnections or
any other business logic operation. AjaxPro just is a AJAX framework,
wraps the XmlHttp API in the client, provider a easy but fast way to
interact between Client and Server.
Of course, it is independent of ADO.NET.
Are your sure your server code works well?
Some Expception may be thrown out when you open the SqlConnection, I
guest.
Unfortunately, you do not inspect the error in the client, and it seems
nothing to happen.
So you could modify your callback funtion as follow:
----------------------------------------------------------------------
function getServerTime_callback(res)
{
if(!res.error) { // sees if some error has happen
alert(res.error.Message);
}
WebForm1.txtInputBox.value = res.value
WebForm1.txtInputBox.disabled = true
}
----------------------------------------------------------------------
In addition, the error object in AjaxPro also providers more properties
like Source, TargetSite, Stack and so on to access the Expception
details thrown on the server side.
Hope helps.
Jinglecat
MxBlinkPx wrote:
> I just started using Ajax.NET and I ran into an issue. I managed to get
> the clock example to work in VB.NET, the problem is when I try to
> connect to a SQL database, the function returns NULL instead of the
> date and time.
>
> Javascript Code:
>
> function getServerTime()
> {
> AjaxTest.WebForm1.GetServerTime(getServerTime_callback);
> }
> function getServerTime_callback(res)
> {
> WebForm1.txtInputBox.value = res.value
> WebForm1.txtInputBox.disabled = true
> }
>
> function UpdateTimer()
> {
> if(timerID) {
> clearTimeout(timerID);
> getServerTime()
> }
> timerID = setTimeout("UpdateTimer()", 1000);
> }
>
>
> VB.NET Code:
>
> Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles MyBase.Load
> AjaxPro.Utility.RegisterTypeForAjax(GetType(WebForm1))
> End Sub
>
>
> <AjaxPro.AjaxMethod(AjaxPro.HttpSessionStateRequirement.ReadWrite)> _
> Public Function GetServerTime() As String
> Dim sqlCMD1 As New System.Data.SqlClient.SqlCommand("...")
> SqlConnection1.Open()
> sqlCMD1.Connection = SqlConnection1
> Dim myReader As SqlDataReader = sqlCMD1.ExecuteReader
> While myReader.Read()
> ...
> 'End While
> SqlConnection1.Close()
> Return Date.Now
> End Function
>
> Of course in this case the SQL command does nothing, however res.value
> becomes NULL if the SqlConnection1.Open() is called. Is there a way
> around this or are you not allowed to open Sqlconnections in an Ajax
> function? Also I am using AjaxPro, not the version 2. -Allen
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ajax.NET Professional" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/ajaxpro
The latest downloads of Ajax.NET Professional can be found at
http://www.ajaxpro.info/
Don't forget to read my blog at http://weblogs.asp.net/mschwarz/
-~----------~----~----~----~------~----~------~--~---