Share via

Adding data to an existing data table with c# code

Alfie Chadd 61 Reputation points
2022-02-23T11:30:49.597+00:00

Hello, I have been trying to create a login program and adding data to a data table that already exists in the server explorer.

so far I have

`private void button1_Click(object sender, EventArgs e)
{

    }`

and the database is called "Logindb" and If I do

Datatable LOGIN = Logindb; 

I just get errors, does anyone know how to fix this?

Thanks

Developer technologies | Windows Forms
SQL Server | Other
SQL Server | Other

Additional SQL Server features and topics not covered by specific categories

Developer technologies | C#
Developer technologies | C#

An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.


Answer accepted by question author

AgaveJoe 31,361 Reputation points
2022-02-23T12:28:00.847+00:00

I have been trying to reuse code from different websites but nothing is working,

Copying code from the internet hoping something will magically work is not a good approach. I would start with a good old tutorial from the official documentation.

Create a simple data application by using ADO.NET

Was this answer helpful?

1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Karen Payne MVP 35,606 Reputation points Volunteer Moderator
    2022-02-23T12:40:22.96+00:00

    The following shows how to login to an application via SQL-Server (in the article uses SQL-Express but could use LocalDb), Microsoft TechNet SQL Server database login for Windows Forms (C#) and if not using SQL-Server there are elements that can help with validating from another source such as MS-Access which is actually more work than SQL-Server.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.