Hi there!
I want to ask about error that occurs when i use database custom tag
the error is :
WARNING! A problem was encountered when trying to process
the input: CUSTOM TAG DATABASETAG halo
with WARNING! A problem was encounter when trying to process
the input:
CUSTOM TAG DATABASETAG halo
with the template:
"<template><databasetag>AYAM</databasetag></template>"
the script is:
using System;
using System.Collections.Generic;
using System.Text;
using AIMLbot;
using System.Xml;
using AIMLbot.Utils;
using System.Data.OleDb;
using System.Data;
namespace ExampleCustomAIMLTags
{
[CustomTag]
public class databasetag : AIMLTagHandler
{
public databasetag()
{
this.inputString = "databsetag";
}
protected override string ProcessChange()
{
if (this.templateNode.Name.ToLower() == "databasetag")
{
String bahancari = this.templateNode.InnerText;
//connect to database
OleDbConnection con =
new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" +
"Data Source=C:\\Documents and Settings\\Jowy Blight\\Desktop\\FinalWebsite\\App_Data\\dbresep.mdb;" +
"User ID=;Password=;");
//query select
OleDbDataAdapter adpt = new OleDbDataAdapter("SELECT namamasakan FROM masakan, mixbahan WHERE mixbahan.namabahan="+bahancari+" AND masakan.idresep=mixbahan.idresep", con);
DataSet msk = new DataSet();
adpt.Fill(msk, "masakan");
String hasilcari = String.Empty;
//concat every query result into 1 string named hasilcari
foreach (DataRow r in msk.Tables["masakan"].Rows)
{
hasilcari += r["namamasakan"].ToString();
}
con.Close();
//return hasilcari
return "tag berhasil"+hasilcari;
}
return string.Empty;
}
}
}
any idea??
thanks.