Click here to Skip to main content
15,897,187 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
VB
string cmdSendSMS2 = "insert into MobileSMS(MsgTxt,MsgDate) values
('" + msgtxt+ by sunil + "','" + DateTime.Now + "')";

where msgtxt=textboxname

where (by sunil)-i want to insert with that msgtxt
Posted
Updated 2-May-13 4:02am
v3
Comments
José Amílcar Casimiro 2-May-13 10:04am    
Your question does not make sense. What are you trying to do?

Sounds like you are looking for parametrized query. Look here for parameterized query and it's usage:
MSDN: Configuring Parameters and Parameter Data Types (ADO.NET)[^]
MSDN: DataAdapter Parameters (ADO.NET)[^]
MSDN: SqlCommand.Parameters Property [^]
 
Share this answer
 
I hope you want to insert the textbox value.so modify your query like this
C#
string cmdSendSMS2 = "insert into MobileSMS(MsgTxt,MsgDate) values
('" + msgtxt.Text + "','" + DateTime.Now + "')";


where your textbox can be like this
ASP.NET
<asp:textbox id="msgtxt" text="" runat="server" xmlns:asp="#unknown"></asp:textbox>


Then it will insert with the value provided in the textbox
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900