Click here to Skip to main content
16,018,949 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I was given a project to store a data in localdatabase I don't know how to create and store the data in local. eg: if I type a name in a textbox the the name must be store in local database I can't figure it out anyone know about it

What I have tried:

https://learn.microsoft.com/en-us/sql/relational-databases/databases/add-data-or-log-files-to-a-database?view=sql-server-ver16
XML
<pre> <Grid VerticalAlignment="Center" Background="White"
          Margin="8"
          Padding="16">
        <Grid.RowDefinitions>
            <RowDefinition Height="auto"/>
            <RowDefinition Height="auto"/>
            <RowDefinition Height="auto"/>
            <RowDefinition Height="auto"/>
            <RowDefinition Height="auto"/>
            <RowDefinition Height="auto"/>
        </Grid.RowDefinitions>
        <TextBox x:Name="txtUser"
                 Grid.Row="2"
                 PlaceholderText="UserName"
                 Margin="8"
                 MaxWidth="200" />
        <PasswordBox x:Name="txtPassword"
                 Grid.Row="3"
                 PlaceholderText="Password"
                 Margin="8"
                     MaxWidth="200" />
        <Button x:Name="btnLogin"
                                 Grid.Row="4"

                    Grid.Column="0"
                    Content="Login"
                    Margin="8"
                    Background="Green"
                    Foreground="White"
                    HorizontalAlignment="Stretch" 
                 MaxWidth="200" Click="btnLogin_Click"/>
    </Grid>

my table design
CREATE TABLE [dbo].[Table]
(
	[Id] INT NOT NULL PRIMARY KEY, 
    [txtUser] NCHAR(10) NULL, 
    [txtPassword] NCHAR(10) NULL
)
Posted
Updated 10-Oct-22 2:16am
v4

1 solution

You need to decide which database to use. For local you can choose from SQL Express (https://www.microsoft.com/en-gb/sql-server/sql-server-downloads[^]) or SQLite Home Page[^].
 
Share this answer
 
Comments
Richard MacCutchan 10-Oct-22 8:05am    
SQLite is a simple local database stored in one file. So what exactly is your question?
Venki Vky 10-Oct-22 8:11am    
in the above code there are two textbox if i click login the user name and the password should be save in a local data base as a table . i am noob @ sql so i don't know how to use it
Richard MacCutchan 10-Oct-22 8:37am    
If you do not know how to use SQLite then you need to read the documentation (the link I provided). You can also use Google to find samples of SQL code.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900