Article View: borland.public.csharpbuilder.language.csharp
Article #41Re: Database problem using AJAX
From: M. Noroozi Eghbali
Date: Thu, 25 May 2006 08:18
Date: Thu, 25 May 2006 08:18
108 lines
3622 bytes
3622 bytes
Thenk you for your response.
I am using AjaxPro 6.5.17.1 http://www.ajaxpro.info/ for .NET 1.1.
This is the Javascript I am using to call the function:
-----------------------------------
<script language="javascript">
function getServerTime()
{
TBNet.Index.SaveData(document.getElementById('Downloads_Email').value,
true,
document.getElementById('Downloads_Fullname').value,
document.getElementById('Downloads_Organization').value,
'Test', getServerTime_callback);
}
function getServerTime_callback(res)
{
alert(res.value);
}
</script>
-----------------------------------
And this is the code I used for the Ajax function:
-----------------------------------
[AjaxPro.AjaxMethod]
public String SaveData(String EmailAddress, bool SendNews,
String FullName, String Organization,
String DownloadedFileStr)
{
int RowNum = 0;
String CommandStr;
try
{
bdpDataAdapter1.Active = true;
bdpConnection1.Open();
BdpTransaction Trans = (BdpTransaction) bdpConnection1.BeginTransaction();
bdpDataAdapter1.SelectCommand.CommandText = "SELECT * FROM Info WHERE
Email = '" +
EmailAddress + "'";
bdpDataAdapter1.FillSchema(dataSet1, SchemaType.Source, "Info");
RowNum = bdpDataAdapter1.Fill(dataSet1);
bdpConnection1.Close();
BdpConnection Connection = new
BdpConnection(bdpConnection1.ConnectionString);
if(RowNum == 0)
{
CommandStr = "INSERT INTO Info (Email, SendNews) VALUES ('" +
EmailAddress + "', " +
(SendNews ? "true" : "false") +
")";
BdpCommand Command = new BdpCommand(CommandStr, Connection);
try
{
Command.Connection.Open();
Command.ExecuteNonQuery();
}
finally
{
Command.Connection.Close();
bdpConnection1.Close();
bdpDataAdapter1.Active = false;
}
}
Trans.Commit();
}
catch
{
return "Test failed";
}
return "Test success";
}
-----------------------------------
I don't know what is the Error message, but after executing the first line
of the Ajax function, the "catch" part is running.
Thank you in advance,
Mehrdad
"Marc Rohloff [TeamB]" <"on request"> wrote in message
news:1993c9wwxgx7y$.dlg@dlg.marcrohloff.com...
> On Thu, 25 May 2006 01:43:51 +0330, M. Noroozi Eghbali wrote:
>
>> Would you please let me know what is my mistake?
> You are really going to need to show a bit more code and also tell us
> what exception you get.
> Also which AJAX libraries are you using?
>
> --
> Marc Rohloff [TeamB]
> marc rohloff -at- myrealbox -dot- com
Technical Details
Message-ID:
<447569c3@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<4474dac8$2@newsgroups.borland.com> <1993c9wwxgx7y$.dlg@dlg.marcrohloff.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 1efe35,432071f934432998 X-Google-Attributes: gid1efe35,public X-Google-Language: ENGLISH,ASCII-7-bit From: "M. Noroozi Eghbali" <galaxy@irandoc.ac.ir> Newsgroups: borland.public.csharpbuilder.language.csharp References: <4474dac8$2@newsgroups.borland.com> <1993c9wwxgx7y$.dlg@dlg.marcrohloff.com> Subject: Re: Database problem using AJAX Date: Thu, 25 May 2006 11:48:23 +0330 Lines: 110 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2869 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 NNTP-Posting-Host: 213.176.22.232 Message-ID: <447569c3@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1148545475 213.176.22.232 (25 May 2006 01:24:35 -0700) Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail