简体   繁体   English

如何从数据库中获取id等于DataGridView1在c#中选择行id的单元格值

[英]How to get id from database that's equal DataGridView1 selected row id cell value in c#

How to get id from database that's equal DataGridView1 selected row id cell value in c#? 如何从数据库中获取id等于DataGridView1在c#中选择行id的单元格值?

I have this code in vb.net, and now I have to convert it to c#. 我在vb.net中有这个代码,现在我必须将它转换为c#。

my code 我的代码

DataGridView1.Item(0, DataGridView1.CurrentRow.Index).Value

Although it's a duplicate from Getting the first cell from selected row from DataGridView in C# 虽然它是从C#中的DataGridView中从选定行获取第一个单元格的重复

getting the first cell value from selected row would be: 从所选行获取第一个单元格值将是:

dataGridView1.SelectedRows[0].Cells[0].Value.ToString();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM