protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(@"");
SqlCommand cmd;
SqlDataAdapter da;
DataSet ds;
int rno = 0;
string result;
string phone;
try
{
da = new SqlDataAdapter("select ParentFname,ParentLname,Phone,AmountDue,AmountPaid,DueDate FROM Childcare where SecurityCode='1243'", con);
ds = new DataSet();
da.Fill(ds, "Childcare");
DataTable dt = ds.Tables["Childcare"];
foreach (DataRow row in dt.Rows)
{
foreach (DataColumn col in dt.Columns)
{
string pname = row["ParentFname"].ToString();
phone = row["Phone"].ToString();
}
}
//string pname = ds.Tables["Childcare"].Rows[rno]["ParentFname"].ToString();
//string plname = ds.Tables["Childcare"].Rows[rno]["ParentLname"].ToString();
//string phone = ds.Tables["Childcare"].Rows[rno]["Phone"].ToString();
//string amodue = ds.Tables["Childcare"].Rows[rno]["AmountDue"].ToString();
//string apaid = ds.Tables["Childcare"].Rows[rno]["AmountPaid"].ToString();
//string ddate = ds.Tables["Childcare"].Rows[rno]["DueDate"].ToString();
//result = pname + plname + phone + amodue + apaid + ddate;
string ACCOUNT_SID = "c29d6563c43b3d24e";
string AUTH_TOKEN = "d5a";
TwilioRestClient client = new TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN);
client.SendSmsMessage("FromNumber", phone, result);
}
catch (Exception ex)
{
Label1.Text = ex.Message;
}
}
Get values from database to dataset and again dataset to variables using data adapter,
Using datareader it working fine At the time of using dataadapter not getting
Once see my above code