TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Hardik Patel
NA
378
469.7k
date converstion error?
Sep 23 2013 5:02 AM
date converstion error?
i m using below code
try
{
string date = System.DateTime.Now.ToString();
string bdate = Convert.ToDateTime(TextBox3.Text).ToString("yyyy-MM-dd");
string str;
string g;
g = "";
if (RadioButton1.Checked == true)
{
g = "Male";
}
else
{
g = "Female";
}
FileUpload img = (FileUpload)imgUpload;
Byte[] imgByte = null;
if (img.HasFile && img.PostedFile != null)
{
HttpPostedFile File = imgUpload.PostedFile;
imgByte = new Byte[File.ContentLength];
File.InputStream.Read(imgByte, 0, File.ContentLength);
}
str = "insert into Student values('" + txtName.Text + "'
,'"+bdate.ToString() + "',
'" + g.ToString() + "','" + txtAddress.Text + "'," + ddlstate.SelectedValue + "," + ddlcity.SelectedValue + ",'" + DropDownList1.SelectedItem.Text + "','" + txtUserName.Text + "','" + TextBox1.Text + "','" + DropDownList2.SelectedItem.Text + "','" + DropDownList3.SelectedItem.Text + "','" + TextBox7.Text + "','"+imgByte.ToString()+"','" + date + "','false')";
Int64 i;
i = ObjConn.ExecuteNonQuery(str);
if
(i > 0)
{
Label1.Text = "Record Inserted Successfully!!!";
Label1.ForeColor = System.Drawing.Color.Green;
txtName.Text = "";
TextBox3.Text = "";
RadioButton1.Checked = false;
RadioButton2.Checked = false;
txtAddress.Text = "";
txtUserName.Text = "";
TextBox1.Text = "";
TextBox7.Text = "";
}
else
{
Label1.Text = "Error while Inserting data!!!";
Label1.ForeColor = System.Drawing.Color.Red;
}
}
catch(Exception ex)
{
throw ex;
}
Reply
Answers (
6
)
compilation error
Wcf -Linq-EntityFrameWork