0

I know I have a similar question but I selected a answer as correct before I actually tested it since technically they were correct I was trying to use .text.

I have html control and im trying to get the input value from the user however for some reason even though I have data when I debug that line it just shows ""

<input runat="server" id="Name" type="text" name="Name"/>

cmd.parameters.addwithvalue("@NAME", Name.value);

name.value never has a value no matter what I put in the input name control.

4

3 に答える 3

2

引用符を削除します。

cmd.parameters.addwithvalue("@name", name.value);

value プロパティの代わりに文字通り「name.value」を渡しています。

于 2013-08-14T12:04:06.790 に答える
1

これを試して

<input runat="server" id="Name" type="text" name="Name"/>

cmd.Parameters.Add(new SqlParameter("@name", name.value));
于 2013-08-14T12:03:30.973 に答える