sql - What do C# Table Adapters actually return? -


Stack Overflow !

I am working on an application that manilates the SQL table in a windows form so far, I am only using pre-generated fill queries, and remove auto-generated updates and queries (Which does not return anything).

I am interested in accumulating the value of a single value in a single column (a 'Nature (15)' name), and although I can easily get that code back for application, It's written, I do not know what will be returned to it like . Contact

  [name before contact] contact where [contact id] = @ current installer  

what results directly as a string Can be stored? Do I need to put it? Call a toString method?

Thank you: Interestingly enough, the following tasks:

  string first name = this.contactSkillSetTableAdapter.GrabFirstName (userKey);  

The joys of the Visual Studio Data Wizard, I think

A TableAdapter is used to fill a DataTable The result of your example query will still be datatable but with a single column in a single row. You can get the value using:

  var adapter = new SomeKindOfTableAdapter (); Var datatable = new datatale (); Adapter.Fill (DataTable); String contact first name = (string) dataTable. [0] [0];  

There are other ways to get your value without using a tablet adapter:

  string query = @ "select [contact first name] Where [contact id] = @ current "; String result; (Using SqlConnection conn = new SqlConnection (connString)) {conn.Open (); (Using the SqlCommand command = new SqlCommand (query, conn)) {result = (string) command.ExecuteScalar (); }}  

Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -