Hi,
iam new to netpoint SDK, i have created table and i have two fields like accounid,accountame i try insert through netpoint.api.dll
pls herewith below i have attached follwing code. Please guide me
how to insert a sample data in sample database.
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using netpoint.classes;
using netpoint.api;
using netpoint.api.account;
using netpoint.api.common;
using netpoint.api.prospecting;
public partial class _Default : netpoint.classes.NPBasePage
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
System.Data.Odbc.OdbcConnection cn;
System.Data.Odbc.OdbcCommand com;
string strsql;
NPBasePage bp = (NPBasePage)Page;
cn = new System.Data.Odbc.OdbcConnection("Driver={SQL Server};Server=btsserverdc02;Database=library;Uid=sa;Pwd=sa2000");
strsql = "insert into Users values('" + txtsample1.Text + "','" + txtsample2.Text + "' )";
cn.Open();
com = new System.Data.Odbc.OdbcCommand(strsql, cn);
com.ExecuteNonQuery();
cn.Close();
}
}
Are you sure it's a problem with your code and not a problem with the license? Can you run the netpoint site as-is?
One thing I would point out is you can pull a connection string from the base page. I believe it would just be bp.ConnectionString in your sample.
If you are trying to add a row to your own table then you can do that without inheriting from the NPBasePage class. If you change that back to System.Web.Page (or whatever it is by default) and try running the code it should work or at least give you another error.
Steve
Add a comment