我试图转换Id字段将其发送到数据库但在DB中类型是bigInt:
var ID_Inscricao = (Label)row.FindControl("Label1");
Run Code Online (Sandbox Code Playgroud)
如何将其转换为与bigInt兼容的类型?我尝试过转换和转换,但都没有奏效.
您需要将标签的Text属性中的值转换为某种整数:
string labelText = ((Label)row.FindControl("Label1")).Text;
var ID_Inscricao = Convert.ToInt64(labelText);
Run Code Online (Sandbox Code Playgroud)
请注意,如果文本值不是数字,则可能会抛出异常.
| 归档时间: |
|
| 查看次数: |
148 次 |
| 最近记录: |