Android Question How to Insert Data in Sql Server from Basic4Android

junaidahmed

Well-Known Member
Licensed User
Longtime User
I have write a program to insert data in sql server using ASP.net Service,I have tried below code bit its not working .Please check below code and advise how to do that...

B4X:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BLToolkit.Data;
using KHEXPORTSLIBRARY;
using System.Data;

namespace SMSDemo
{
    public partial class FrmToDo : System.Web.UI.Page
    {
        DbManager Db = new DbManager();

        public static string StrQuery;
        
        protected void Page_Load(object sender, EventArgs e)
        {
            StrQuery = "";
            StrQuery = Request.QueryString["Param"];
            Db.SetCommand(StrQuery).ExecuteScalar();
        }
    }
}


B4X:
Dim job As HttpJob
job.Initialize("Job1", Me)
StrQuery = "Insert Into KhArind.Dbo.Todo Values('" & StrDate  & "','" & CboAssignTo.SelectedItem  & "','" & TxtMessage.Text.Replace(CRLF," ") & "',0,'" & StrDueDate & "')"
        job.PostString(StrURLPath&"SMSDemo/FrmToDo.aspx",StrQuery)
 
Top