user4569202
user4569202

Reputation:

insert data from textbox with multiple lines contents into sql table

i have put the following code in .aspx

<asp:TextBox ID="txtyourwords" runat="server" Rows="1" TextMode="MultiLine">
</asp:TextBox>


SqlCommand cmd = new SqlCommand("Insert INTO planning_t (date,course,planning) values("+Calendar1.SelectedDate.ToShortDateString()+","+DropDownList2.SelectedIt‌​‌​em.Text+","+txtyourwords.Text.ToString()+" )", con);

now i want to insert the contents of textbox--(txtyourwords) into a table... what will be code in C# for .cs file. and datatype for this column is varchar(MAX).

Upvotes: 1

Views: 932

Answers (1)

user4569202
user4569202

Reputation:

SqlCommand cmd = new SqlCommand("Insert INTO planning_t (date,course,planning) values('"+Calendar1.SelectedDate.ToShortDateString()+"','"+DropDownList2.SelectedIt‌​em.Text+"','"+txtyourwords.Text.ToString()+"' )", con);

Upvotes: 1

Related Questions