C# Desktop and Android Studio App and SQL Server Project
1K views
May 21, 2025
📌 Project Overview: In this video, we showcase a powerful full-stack application built using C# for Desktop, Android Studio for mobile, and SQL Server as the backend database. This project demonstrates seamless data communication between desktop and mobile environments using shared SQL data. 🎯 What You’ll Learn: Desktop app UI & functionality with C# Android Studio mobile integration SQL Server database connectivity Syncing data between devices Real-world project example 🔧 Tech Stack: C# WinForms Android Studio (Java)
View Video Transcript
0:00
hi guys welcome to tutors funny channel in our last class I saw the demo of
0:07
C#.NET with Android plus SQL server in this class I'm going to teach how to do
0:13
the project step by step right today's the first day first what I'm going to do is here I'm going to create the uh
0:19
Windows application of C#.NET so I already open the Microsoft Visual Studio
0:26
now first go to the file new I'm going to create the new
0:34
project right here I'm going to create the select the language as car with windows application click
0:48
okay right now your uh new project has been created successfully this is a blank form I'm going to design that one
0:55
so what I'm going You see here first things what I'm going to do is here go to the toolbox
1:02
uh all windows form here I'm going to drag three labels
1:08
uh uh three labels right
1:15
what first one should be the post
1:23
ID right second one should be the course
1:34
name third one should be the field these are three fields now we have
1:41
to drag three textbox
1:47
fields right now we have to align it
1:59
right right perfect now what I'm going to do is here you have to set like this
2:05
now I need one button for save the data so we have to get drag one button
2:11
right perfect this is the Windows form this I have named it
2:17
as add right simple Windows but click on
2:24
this one i'm going to make the title as form title I'm going to give as
2:29
post
2:34
registration right now if you click on this one when
2:39
the uh project is run it's start position I am going to send select as
2:46
center screen if you start the product you can see
3:04
here it's running at the center right now what I'm going to do is here I'm go I go back to my database SQL Server i
3:11
have installed my machine Microsoft SQL Server 2012 i'm going to log in
3:18
that right I log in
3:26
successfully now here I'm going to create the new database so here there will be the for database folder I'm
3:33
going to create a new database I'm going to create the new databases as co
3:42
app Awesome click
3:51
okay right now your new database has been created successfully you just click just plus sign and expand it here you
3:58
have to find OA okay this one should be your newly
4:05
created database right now here you have to expand it inside the database we have a table i'm going to create that new
4:11
tables so right click new
4:18
table here you have to specify the columns right first one should be the course ID so I'm going to I just type as
4:24
C id right this one should be the C ID uh so here we have to set this one as we
4:31
have to create int type int
4:42
Right after that uh we have to set check second one as C name mean post
4:47
name watcher right after that C we have to
4:53
set as eat right that's the field I'm going to set is this one we have set as private
5:00
primary key after that we have to click save right now here we have to uh the
5:07
name name as we have to name it as this one as a registration simply r the simple table
5:16
right very simple table I have made it now what I'm going to uh go back to my C# double click on the add
5:26
button right now here I'm going to connect with the database and add the
5:31
records into the database so first what I'm going to say create the name face using
5:37
system dot data dotsql client right this is the name
5:44
space you have type for type the SQL classes after that we have write the SQL class here so connection SQL
5:53
connection SQL connection con here create equal new SQL connection you have
5:59
write here is server equal dot
6:05
a local dot mean is a local machine so that here this I have connected as a local machine so that you have to put uh
6:11
here this a dot right server name dot right so I have put dot here after that
6:17
what I'm going to do is you have to type another surface server after that you have type
6:23
initial
6:30
chat right here correct initial
6:36
catalog catalog you have to specify the database name what's the database name co app right the database co app so you
6:44
write co app the database right the database name correctly cos Right after
6:51
that you have to write as a integrated here you have to write username us
6:56
ID user id equal what the use ID
7:02
use a user ID user ID what's us ID you have type
7:08
this use ID means
7:14
password equal blank this is the things you have to type right this is
7:20
Right after that what I'm going to do is here we have write the thing is password
7:26
is no admin 1 2 3 so admin 1 2 3 this a password SQL login username and password
7:33
right so login s username password admin 23 by
7:38
installing the SQL server I give that right after that I'm going to add the records into the database so I'm going
7:44
to write anything SQL command cd
7:50
D5 perfect after that we have to write here the button right double click on
7:56
this button we have to type this one we have to name that inside this one should be I'm going to name it
8:03
as right I click properties we have to name it as this one has a c txt
8:13
cycle this one txt C name host name this
8:22
one txt cent right also correctly done now what
8:30
I'm going to see I'm going to write here is string c id equal
8:37
txt c id dot text after the
8:42
string came equal txt post name dot text
8:49
after that we have to write string feal txt fe text right after that what
8:58
I'm going to see I'm going to add the records in the data so here write cmd equal new sql command if you write here
9:07
is insert into what is the table you're going to insert the record registration table I'm
9:15
going to insert the record so what are the columns you are write Here you have to type the name without a spelling
9:20
message which is the column right C ID C ID C name
9:31
C here I have write a
9:36
values we have write here is you have write here the C is your
9:42
copyr copyr paste here you have put it
9:50
Right that's the thing we have right now now here after that what I'm going to do is here uh we have to write a connection
9:57
object con this connection object right database connection object that's the thing you have right after that open the
10:04
connection conopen this is the must open it after that you have write here cmd
10:10
dot uh cm parameter dot add value with
10:16
write here this one this parameter copyr paste here comma Uh
10:23
sorry bracket inside the bracket you have to paste it here comma this
10:30
variable this variable see
10:36
I after that what I'm going to do is here same thing we copy ctrl C to copy
10:42
control V to paste here second one should be C name C so this C name Copyr V to paste here here also C this one CR
10:51
paste here same Control Copy control V paste here as well see control C paste
10:57
here this field right okay these are the parameters these are the values right
11:03
what what you type on this text box these values are assigned to this particular variables these variables I
11:09
am going to pass it here it will be pass it in this parameters these parameters
11:14
are goes here it's put into the relevant columns to add their records into the database right that's what I done so far
11:21
now I'm going to call it as cmd execute non if you call this function that is
11:26
added into the database right finally we have to show the message
11:32
whether record is added or not into your database so you can check the message right so we have to message dot show you
11:40
have to write record added right after finally we have to
11:47
close the connection con.lo that's it now let's check whether it's
11:52
working fine or not right right now here I'm going to add
11:58
the course ID 1 post name Java fee
12:05
10,000 click add button record added fine let's check on the database whether
12:12
it's working fine or not this is the table
12:17
now here we have to select top this one
12:23
drop right here it's added successfully right it's added successfully now C# is
12:30
working successfully now let's do the programming in Android Studio how to design the uh
12:37
how to design this uh like this and do the stuff now here what I'm going to see go to the file I'm going to create the
12:44
new app uh new file Add new new
12:50
project okay i'm going to name it as
12:57
Oshap right click next next select empty activity
13:07
next here we have to finish now your project is created successfully now here select
13:14
the activity main here I'm going to design the app right now here this is
13:19
the default command hello world here you can zoom in check check right here right
13:24
now what I'm going to see here there will be the three views available design blueprint and design plus group
13:31
blueprint right these are three views right now first what I'm going to see here we keep it up design let's go to
13:37
the this RS folder inside RS folder there will be the file called activity
13:43
main doxml this is the file right we design right now here this is a design view this is a text right now I just
13:50
click on the text right here text it's easily designed with the code right now here what I'm going to do is here I'm
13:57
going to change this one as a simply select this one you have change it as linear
14:08
layout linear check as that's the thing you
14:14
have to after that we have what I'm going language here you have write orientation
14:19
orientation vertical
14:25
gravity center right this is the thing we have to put first right this thing right
14:30
after what I'm going to see I am going to create another linear layout we have to say this one we have to create
14:37
another linear layout layout uh here we have write tax rep tax sorry w content w
14:43
content here we have write after that uh we have to write uh rep content w content Okay you have to write nothing
14:50
is here you have write orientation have uh here orientation
14:57
here also you have to write orientation vertical vertical that's something we
15:03
have perfect after that here we have write text view right the text view we
15:09
have to write text view text view also we have to uh wrap
15:14
content wrap content height Right after that we have to write the
15:21
uh uh text right we have to write the text what is the text you have to display you have to write here is
15:28
course app you have to write text course app after that we have if you want to
15:34
make a color text color you have to write text color you have to write here is fine just any color you can write
15:41
fine right text size you have right you just write text size you have write here is you have to small right 30 small
15:50
right now you can check the design here it's working fine right it's very simple after that what I'm going to do is here
15:56
this is what first linear lay linear layout after that I'm going to create another linear layout below the same
16:02
linear layout I'm going to get the copyr to copy control to paste below the same line layout here orientation also
16:09
we need to change as or horizontal type right horizontal type after that uh
16:15
these things uh all are same keep it up same after that we have to change the uh
16:21
these things all right we have to change the text we have to change the text is and text co
16:28
ID co ID this one we no needed this one we don't need that we have to co ID here
16:37
coid look like this Right right after that what I'm going to use here I need to design another
16:43
signature uh this one edit
16:51
text edit text this web content web
16:56
content after that we have to write another thing is uh here uh ID ID Android ID you have set as
17:05
android id as you have set as uh this one should be the co ID ci you just type
17:10
as ci right simple type right after that you have uh layout
17:16
weight layout weight you have type as this one layout weight one and
17:23
em 10 text
17:31
alignment text alignment center right that's it now let's check the design here it's
17:38
working fine right the same thing what I'm going to do is here get the copy and do it
17:45
again okay the same thing you have to do again by again what I'm going to do is same thing you have to
17:51
copy Ctrl C to copyr to paste below the second one I'm going to change that
17:57
course name this one C name right C name okay now let's check
18:05
the design here it's working perfectly right after that what I'm going to do is here go to the text the same thing get a
18:12
copy of that C to copyr V to paste below this one should be fee co fee co fee
18:20
right here also fee right now you can check create the
18:26
design cost id cost name cost p after that we need a button we need a button
18:32
for that very simple button also we have to do the same thing uh here also we
18:38
have to get the copy layout copy paste here now here we have
18:45
to this one we have to remove these two two things instead of that we have to uh
18:51
design as a button right so we have to write button
18:56
But button also we have write content grab
19:02
content after that text we have write the button text also we have write add
19:07
button add button here also ID we have write ID btn
19:14
btn btn button right here also button color so also I'm going to change as uh
19:21
this one also this this color after that uh text color I'm going to change text
19:28
color i'm going to change text color i'm going to change here also i'm going to change uh this color i'm going
19:36
to right it's a white color right you can check here it's perfect right so
19:43
design is perfect right okay perfect now what I'm going to do is here I'm going to add the quotes right
19:51
so here this this one should be the design view if I make I'm going to add
19:56
the code if I fill this form click add button record goes and added into the database SQL database right so what I'm
20:03
going to do is here go to the main activity Java right this is the file where we hope right so this file you can
20:11
find it here as well go to the Java folder inside the Java folder uh this is the package inside the package there
20:17
there will be the file main activity right main activity file what I'm going to do is here here uh here after that
20:25
here after the class main activity class section
20:31
uh section this is one after that what I'm going to use here we have write how
20:36
many text box available you have to specify how many text box three text box available so we have to write here is
20:42
edit text we have to create the three variables
20:48
ed2 ed3 there are three text box right after that we have one button so
20:57
button bt b1 right that's it now what
21:02
I'm going to do is here we have to go to the inside the on create method on
21:08
create method here we have to get the this variables and equal to the relevant
21:13
fields right ed variable equal to find view by id find view by id r dot
21:21
id dot what is the button which this is the button this is
21:27
the text box c I have to what's ID here you give c I you just type here c I will
21:34
right fine by this it will be equaling to this variable right this things we have to second one should be ed to this
21:41
variable equal to find view by id
21:48
find view by id r dot id dot c name is a
21:55
c name co name after that ed3 equal find view by
22:00
id find view by id r do id dot fe right
22:07
we successfully equal to the relevant variables here finally button also here so B1 find view by
22:16
id R dot id dot btn1 right
22:23
perfect right now what I'm going to do is we have to this button we have to uh
22:29
write here is simply B1 dot set on click
22:34
listener new view on click listener press enter key it's automatically
22:40
generate the on click view right here we have to write now we have to create a separate method for that we have to
22:46
create a separate method for to insert the code it's very perfect one professional one so what I'm going to do
22:52
see here you have to create a separate method right so you have to write
23:01
public connection
23:08
at connection at right here write connection
23:14
at connection at right so you have to open and close that right it has the
23:19
name here alt key press alt key on your keyboard and enter key it's ask the name
23:25
you have to import class right so it's SQL class is important right SQL right
23:32
so that here after that what I'm going to write here is
23:38
uh you have to write first we have to get the IP
23:43
string IP this IP address you have to clear what's the IP of the machine right
23:49
what's the IP address of the machine you have to simply go to the
23:55
run cmd go to the command prompt cmd
24:01
uh here you have to type cmd is open right
24:09
here you have to find IP address like this IP config you simply Type IP config
24:16
press enter key what is the IP address of your machine is generated here this
24:21
is this one should be your IP address see this one should be IP version 4
24:28
address this is the your IP address of the machine right this is IP address you
24:34
you have to write it here simply you have to write it
24:40
here all right you have to write it
24:49
here simple you have to write mean inside double quotation you have to write this the IP address you have to
24:55
write simple a dot right that's
25:02
it that's the thing we have to perfect right after that what I'm going to use
25:09
is here after that we have to add the driver relevant driver so connect uh SQL
25:14
server to Android so what I'm going to do is you go to the Google and search
25:20
here JTS jar download right so here there
25:26
will be the links available here if you click on this one here the first link here click here you will be able to
25:32
download the driver right here you will be there will be the drivers right you will be able to drive on uh download the
25:38
driver right now I have download this version download JTS uh 1 uh7 this one 1
25:45
2.7 this one I have downloaded you just click on this link and you'll be able to download if you click it it goes here
25:52
you click here it will be downloaded right here it's downloaded right so I already downloaded so I no need to
25:58
download again by again so what I'm going to after downloaded what I going to do is here go back to your Android
26:04
studio here you have to import the file so how to import the file is you have to
26:09
go to the here this one select here as a uh this one as a
26:15
project project here you have to select the li inside the app folder there will
26:20
be the folder called li here what I'm going to see inside the lip folder you have to put into this file right ltd
26:26
this one right you just click and extract it right you have to extract it
26:31
it's like this is this is a file you have to copy them this jar file copy
26:37
simple you You have to open the Android Studio here here this is lip you have to paste
26:43
it paste it right and you'll be able to see the chart all right just able to see the
26:51
chart okay that's the thing you have to do right after that after done the stuff what you are going to uh do is here uh
26:58
you have to uh add this as a library yeah click on the jar this one this jar
27:05
this jar here there is the option add as library you select click on this one okay click
27:12
okay click okay right it is added successfully it's added the jump right you have to make that option uh option
27:20
okay then only it's added the into the Android j right simply okay here this
27:25
process is running so it's added successfully okay you can check here after after process is completed here is
27:31
now adding here this process is running so it's keep on adding to the ID after
27:36
the process is completed you can check it here right so you have to wait until the process now the process is completed
27:43
now load the file you have to check it here right file uh here you have to check here uh project
27:54
structure project structure project uh here here project structure
28:01
uh app dependencies here the jar is added
28:06
successfully you have to get the jar here dependencies right the dependencies added successfully right this how you
28:12
have to get the dependencies now server right that's how you have to check whether it's added or not add or not
28:18
right after add successfully now you have to get the uh thing is you have to write a classes here string you have to
28:24
add class equal you have to write here is this simple you have to add this
28:29
class Next dot uh source source
28:37
for right type the name carefully jt ds dot jdvc
28:46
dot
28:53
driver okay now here what is the problem class darknet sound
29:09
okay the problem is you have to have predefined keyword
29:15
classes that's the problem right java the predefined keyword classes that's why the problem right i have to put
29:20
additional list right that's that will be the problem right after that what I'm going to do is here uh you have to write
29:25
a DB right string DB equal what's the DB what's the database you have created
29:31
right i have created a database called co app that's the database I have created okay co app so you have to
29:37
mention here course app right type the name carefully post
29:44
app right this how we we have to make the connection after that the username and password you have to enter here
29:53
string username username equal username equal
30:08
Right uh username is SA password is same
30:14
thing you have to write password after that control C copy control paste here so
30:22
password admin 1 2 3 this is the database SQL server username
30:28
and password right in order to connect right after that you have write the additional line we have added here uh
30:34
the
30:43
spec policies strict mode policy strict
30:51
mode dot trade policy
30:57
policy you have to write create policy equal new strict
31:09
mode dot policy here t write dot
31:16
builder policy dot
31:22
builder builder all right that's it
31:29
dot permit all dot
31:37
build right that's the thing we have to after that you have to add the second thing is a strict
31:45
mode dot
31:50
set policy that add this policies here ctrl + C to copy ctrl + V to paste here
31:56
after that you have to write the connection right connection object c the connection object connection you have to
32:02
get the object null after that you have to write here
32:08
is string URL st
32:17
URL string URL right now here after the I write connector class right connect
32:22
class dot for name you have to write here is this class this class we have
32:29
right here classes you have to add the appropriate driver here perfect right
32:35
[Music] classes have got to import the try and
32:42
catch perfect now what I'm going to do is here we have that connection
32:48
And what you have to write as this URL
32:54
[Music] equal you have to write this one path
33:00
JDBC dot JT DS is a
33:05
driver SQL server SQL server you have to write
33:12
the write like this you have to write like this after that class first one should be the
33:20
IP this IP address after that we have to write the
33:27
question this one like this after that uh we have to write the
33:32
plus sign again two plus sign inside the plus sign we have to write the again the database name DB control C copy ctrl C
33:41
to paste here after that we have to write uh uh username how does we have write a
33:48
username here username we have to write
33:55
user equal
34:01
plus username past copy paste here after that
34:06
we have writers uh username after that you have write the same thing as a password field as well copy and paste
34:13
your password this one should be the password password you have to write like this password the password will look
34:20
like this after that you have to write aation password this
34:27
password you have to write like this simple right so simple after that you
34:32
have to call it this how you have to connected this
34:37
as right this connect it right very simple
34:45
right these are all the things it's we have to connect it here right after the I'm going to see we have to check con
34:53
object we have created here get it here equal driver
34:59
manager driver manager dot get connection URL
35:09
Right so we have to add the catch as after that what I'm going to say
35:15
prepare state we have to write the prepar statement t same like a java right after
35:22
this one also I'm going to ext same like java now we have to write
35:28
here S uh first we have to write here uh string
35:35
[Music] id C ID cos id equal your set to the
35:42
relevant fields c ID mean this one ED1 right so you have to write C
35:49
E1 dot get
35:55
text right after that second one should be
36:01
there text right dot two you have to write two string other show right after
36:07
that the same thing copy control V to paste here this are C name this one should be
36:14
two here this one should be a Right name should field should be this variable it
36:20
should all on two field mean it's all on the value three right so you have to
36:26
like that you have to write three c right that's it that's the thing you
36:32
have to do now I am trying to add the records into the database so you have to write a PST prepare statement write
36:40
con statement [Music] Here we have to
36:47
write insert into which table you are going to add the
36:55
records i'm going to add the records into the reg registration table so I have to write the reg uh table in my SQL
37:03
server after that uh we have to try to specify the column names correctly these
37:09
are the columns right uh C ID C name C right you have to write C ID C name
37:17
C how are the values how do you write values you have
37:23
to write three question mark so prepare statement you need a three question mark right after that what I'm going to do is
37:30
you have to like this simple you have to write here PST six
37:37
string one comma this one should be I see C
37:43
copy paste after that this C copy paste right second one should be
37:51
C past here third one should be see copy paste right after that what I'm going to
37:57
do is here we have write tst execute update execute update
38:07
Okay we have a message to dot make toast
38:14
dot make text this
38:19
comma record add you have to write the toast message
38:26
here you write toast length
38:36
dot show right that's the thing we have to add the record we need to clear the text
38:42
box fields so the same thing you have to write here ed1 control copy dot set
38:48
text clear we have write same like java right it's also control copy control
38:55
paste here this one two this one three finally you have to after add the record
39:01
it focus on that because I will focus request focus method that call request focus method
39:06
like okay let's check whether it's working fine or not right I have virtual device I have used the J
39:14
gen motion you have to connect anything else I have using in your gen motion right this is the virtual app I'm going
39:19
to use for uh doing the stuff now what I'm going to say now here what I'm going
39:25
to say we have to check everything is correct here we have return finally we
39:30
have to return this connection this
39:36
connection connection is connection now the error is go away this
39:44
is the thing we have to worry okay now what I'm going to say this add method control C copy you paste inside here
39:52
when the button is clicked which added the records into the database right now now there is no error now I now here
39:57
what I'm going to do is we have to check here whether the code is correct or not uh uh here the IP error DB we have to
40:06
specify the database name here we have to write here uh data base
40:13
name plus name right we have write like this okay perfect equal database equal
40:19
to name equal right this thing we have to write perfect right now what I'm
40:25
going to see everything fine now I'm going to go to the manifest file manifest file we have to add the
40:33
internet uh user permission for the internet right so here I already done the stuff here the manifest file here
40:40
this same permission you have to add here C to copy control V to paste it here right you have to type like this
40:46
okay uh here you have to write simple you have to write user permission Android internet right that's the thing
40:52
you have to write after that you have to write the same thing as uh this one right here same thing as you have write
40:57
here this one as well right permission Android permission actually you have to write like this you have to give the permission right
41:04
uh here this one network right Android access network right you have to add the permission you have to select from here
41:10
it's very simple you have to get the network permission from here you have to choose right that's how you have to add
41:16
the permission right okay I have already added here the same thing you have to add right this I think very important
41:22
stuff right you have to add this permission these two permission into the Android manifest doxml file then only it
41:28
should work right okay now let's check whether it's working fine or not uh everything Perfect what now let's
41:37
check what okay now let's click start
41:42
gen motion this app genotation now I'm going to start the
41:49
app right perfect right now here it's coming here now I'm going to add the student ID
41:57
3 host name I'm going to write as PHP see I'm going to enter as
42:05
20,000 click add button success right it's working fine right now let's check
42:11
go to the database registration table fine so it's working fine great
42:18
it's a PHP success it's working fine right very simple one you have try
42:24
yourself right while you're getting any problem you can ask me anytime uh now after that what I'm going to do do is
42:30
here I'm going to view this record in in the list view in my next tutorial I'll be explained uh how to view this after
42:38
add the records you will be able to view the records in the list view in my next tutorial I'll be explained thank you for
42:44
watching if you like my channel please subscribe me like me thank you for
42:50
watching hi guys welcome to tutori channel in our last class we saw how to
42:55
add the records into the SQL database in this class I'm going to teach how to how
43:01
to view the data from the database and how to edit the data as well as how to
43:07
delete the data right let's go to the lessons right here
43:14
uh this is the design bar now what I'm going to do is here I'm going to create another
43:22
activity right i'm going to create another activity here so that go to the apps folder right click
43:30
new activity here I'm going to create as a
43:35
uh empty activity right here we have to click finish this one we have to select as
43:43
view this one should be view right click finish
43:52
now your view activity has been created successfully this is the Java file and here this one should be the layout of
43:57
the view activity right now here what I'm going to do is here I'm going to view the data right here so view the
44:05
data i'm going to here go to the pallet of the Android Studio here search here is list view i'm going to view the data
44:12
from the list view right if you type LI here this one should be the list view here just drag and drop
44:21
here right it's coming look like this now here what I'm going to go to the go here same thing you have to change this
44:28
one as a earier we did it in a record insert part we have to change
44:34
the layout as a linear layout the same thing you have to change here as a linear layout and the and you have
44:40
change here as as as a orientation vertical vertical right okay this is the
44:48
you have to do right same thing you have to do after that what I'm going to do see we have to write here is a
44:54
uh same thing you have to do here is
45:00
uh orientation you have to type here is ID
45:07
right here is list one I give the ID like this
45:13
that's the thing I have to we have to do this is the things right that's the thing you have to do this is look like
45:18
of a of a list view right simple list view look like this right you can check
45:23
right here likewise right now what I'm going to do is here
45:29
uh I'm going to go to the uh java right view java file here so
45:36
here we have to first what I'm going to do is here we have to type here list
45:42
view I'll type list view this one list you create a
45:49
li one right perfect after that what I'm going to assume we have to write here is
45:54
simply you have to write array list you have to write after that array
46:00
list array
46:06
list you have write here is
46:11
spring write titles equal
46:18
New array list control C to copy control V to paste here you have to write this one
46:28
string after that this one right perfect after that what I'm going to do array
46:40
adapter array adapter you have to write like this perfect after that what I'm going to do is here we have to write
46:46
here is you have to list one this one I create the the
46:52
variable above I have to find it this one we have to equal into find view by
46:58
id r dot id dot list one this one we have to take it
47:06
okay list one mean this one where is the name list one okay here
47:11
I have added into the code here list one ID Android ID so you get it here after
47:16
that what I'm going to do is here uh we have to the same code go to the uh this
47:23
one main activity main dot here this one insert code we have written right the all the connection and every stuff we
47:29
have to copy from here right instead of u adding the uh from the beginning so
47:34
you have to get the copy of this one right you have to get a copy
47:39
uh here until the this one you have to get all the stuff try catch all the stuff you have to get the copy
47:46
Perfect i think you have to get the copy of that one right after that what I'm going to do is here to copy control C
47:55
copy this one we have to go to the here view inside here you have to paste
48:00
control B to paste here right all the classes should be added no problem here successfully right okay right now the
48:08
same thing this one should be our database name this is your username and
48:14
user name uh user credential of uh SQL server this is the uh strict mode right
48:23
okay here all the stuff are same database connected also here what I'm going to be no need this stuff here I'm
48:30
not going to add the data so here what I'm going to do is here we have to remove them this one we no needed here
48:37
after we have to do the quotes right now here what I'm going to do is here we have to create the statement class so
48:47
statement statement here statement ment is tmt equal
48:53
uh connection object dot create statement after that what I'm going to
48:58
write result set result set uh rs
49:05
equal st empty st dot you have to write execute
49:14
query you have to write execute query here we have to write the select statement
49:21
Select all from what is the table name table name
49:29
is registration reg we have to view the data from the registration table after
49:36
that what I'm going to see this title array list array list titles title
49:44
titles price so you get it here ctrl C to copy Ctrl + V to get it here first
49:50
you have to clear the one array you have to clear the one after
49:56
that what I'm going to do is here we have to write two times short right after that what I'm going to do here you
50:02
have to write simply uh write a final keyword
50:08
final array
50:14
list array list right now here what I'm going to say I'm going to create this class right you have separate class I'm
50:21
going to create here right click select the inside the Java folder there will be
50:26
the package com uh example uh course app right click here I'm going to create the
50:31
Java class separate Java class I'm going to create here you have to name it as course you have to name the class name
50:36
as course click okay right here I have to create relevant properties so you
50:43
have to write string ID this is a course ID come after
50:48
that you have to write Then second one string co name
50:54
co simple write co right after that you have to write another thing is a string
50:59
c right this a simple word we have created on the this class right after
51:04
that what I'm going to say go here you have to write array list you have to write here array list you have write
51:10
here is co this this class we have to get it here write separate very simple
51:16
one after that we have write the list equal
51:22
new this one array list course to copy control V to paste here this is the
51:28
thing we have to do okay after that what I'm going to do is while we have write the while loop
51:36
this result set RS dot
51:41
next you have to write here is
51:47
course you have to create the object equal new
51:55
course after that what I'm going to say is object we have to call it here object dot
52:01
id equal rs dot get
52:08
string we write here is first one should be the id first one should be this ID c ID E
52:15
after the C name C this is coming from the database right it's loading all the details we are passing here right RS dot
52:22
it is here I call it RS we are passing here this is coming from the this ID is coming from this class right here it is
52:30
display and assign to this variable right okay out of the same thing C copy
52:36
control V to paste here right second one should be the simply get it at a course
52:43
right this one should be the Suppose here we have to change the name as uh C name C
52:51
name or this one should be the fee dot fee after that here also
52:58
fee all right that's it after that we have to write
53:03
list dot add which one you are going to add
53:09
here's the object we have to add control field copy paste here that's it that's the thing you have to do after the final
53:15
you have to write titles add here we have to write you have to
53:20
add OB this one we have to add ctrl C copy control V to paste here
53:27
plus here to write as a this one should be the tab key of of Java tab key right
53:33
T mean tab right after that plus we have the second one should be we have to show on the uh
53:40
ID plus course after that plus we have to
53:48
equality tap key after that we show here as OBJ dot C that's it That's the thing
53:56
we have to show all right that's it after that what I'm going to do is here
54:02
we have to right after that we go here after that what I'm going to do is here
54:08
I'm going to view the page so I need the main so what I'm going to do is here I'm
54:14
going to go to the app folder right click i'm going to create the another uh empty activity new activity here empty
54:23
activity here I'm going to this one name it as
54:28
main only right this is a main part right you can uh create the course and
54:36
uh there there will be the button you can you will be able to create the course you'll be able to view the course
54:41
right so you needed two buttons right so click finish the
54:48
activity right now your main activity this and
54:54
created successfully this is the layout of that this is the layout so here this is the layout right so
55:01
here right the grid is loading
55:08
right okay you have to wait until the process is
55:18
[Music]
55:24
finished all right now it finished successfully now what I'm going to do is see here this is the main and here this is
55:32
the this is our uh RS folder inside RS layout here
55:37
i'm going to design the one right so here what I'm going to see here this one main two this one right here I'm going
55:44
to design the one right so this is our main this is the this right now here
55:50
this one I'm going to call it as linear
56:00
layout right here we have right
56:05
orientation vertical right Now what I'm going to say here I need two buttons
56:11
only so first we have to need a label so we have to write linear layout another linear layout you have to get linear
56:19
layout write linear layout here uh width we have to write w
56:28
content height also copy this one should be the w content here we have write
56:34
inside here we write here is uh text so you have to create the one text view here we have to also we have to create
56:40
here iss uh orientation also you have to write orientation also we have to write
56:47
vertical right here we have write the text
56:54
view right text you have write content drop content
57:00
right after that you have text you have to write this ID android test you have
57:06
to write uh simple
57:13
Cosap right this is the thing we have to write first right here you have to text size you have to write text size you
57:19
have to mention the text size 30 small right after that you have
57:25
to make the text color you have to write text color as this one right that's it
57:30
that's the thing you have to do after that what I'm going to do is
57:35
here same You have to write uh this thing right
57:41
you have to write you have the same layout line layout control C copy control V and
57:47
paste below here we have right here is uh uh
57:53
this one orientation
58:00
dot orientation horizontal right after that
58:08
PV center right okay perfect after that what I'm going to do
58:15
is here we need two buttons only here so we no need the text view so here we we
58:20
have a text view here we go to the design you can check the text view ID so here we have write here uh two buttons
58:25
we have to create the two buttons here uh we have to create two buttons so we have to create
58:33
button right uh here we button width we have to give as small and we dB we have
58:40
to set as dB right the height also same thing 100
58:48
dB all right after that what I'm going to do is say uh we have to uh background
58:54
color we have to write as this one primary after that we have to write as a
59:01
uh Next you have to
59:06
co course [Music] registration after that text
59:13
color you have to write some color so right here is
59:19
FF F right this is a white one right so you can check the design here right
59:25
second button I got the same thing uh here we have to uh another thing is you
59:30
have to id you have to set it here as this one should be the must and id bdn
59:36
one out the same but I'm going to get the copy control copyr paste here below
59:41
uh this one also all the settings are same we have to change the background color as a this one should be the we
59:47
have to write background we have type here background we have to write this one
59:54
second notation right that's it this one should co
1:00:00
view here also bdn two this button id should be true that's the thing you have
1:00:06
to do now let's check the design this is the design right simple one okay so if
1:00:12
you want to do the things as here you have to check you have to gravity you
1:00:17
have to make it as center you will get the nice look here right it's get a nice look at the center
1:00:25
right you have to make the things right here okay perfect okay after that what
1:00:32
I'm going to do is here uh I'm going to uh do the main activity go to the main
1:00:37
activity this one main activity here first I'm going to create
1:00:42
this main right this button main right so you have to write
1:00:50
button B1 B2 right here we have to get it here is
1:00:56
B1 equal find view by id R dot
1:01:04
id dot uh we have to write btn 1 after that b2
1:01:12
equal find view by id r dot id dot btn 2 all right what I'm
1:01:22
going to do is see you write BT B1 set on click new view on click press
1:01:30
enter key it generated the on on view right okay now here we can add the uh we
1:01:36
have to if you click this button we have to be on it goes to the uh which form uh
1:01:43
this one uh first one first but should be user registration second one should be view
1:01:50
activity Right btn one mean this one should be
1:01:55
the registration right so here this one should be the registration btn one mean
1:02:00
uh this one this file so should be the registration second one should be the view right so here first we have to
1:02:07
write here is uh you have to write here is you have to write here first we have to write go to that page so we have to
1:02:13
write uh one activity to another activity we have to
1:02:19
pass we have to send the form so write here
1:02:25
intent we have to write here main main mean this class we have to write
1:02:33
main dot this which form we have to go right
1:02:40
which form main activity main activity dot class class this is thing we have to
1:02:48
write okay okay when you click this button it visit to the uh main activity
1:02:53
class right this class user able to register so we have to write here start activity I we have to call it like this
1:03:00
right after that when the user click second button so we have to get the second button again write the second
1:03:07
button code you have to write here btn sorry
1:03:14
you have to write here second one button b2 dot set on click listener new view on
1:03:22
click press enter key right now here what I'm going to do the second one I'm going to write here is the same thing
1:03:28
here copy control copy here only change these things the main mean this form to
1:03:33
which form you are sending the value uh view right view p if you click this button right this is the thing you have
1:03:40
to do right after that when The app is open it's open from the main main so
1:03:46
what I'm going to do is here we have to go to the uh app manif inside the manifest file Android manifest xml
1:03:52
double click on this so we have to write here we have to starting position we have to give us here main right this one you have to make it
1:04:00
as a main activity right okay it's main activity
1:04:05
mean it's starting from the registration form so registration form gave you here main mean starting from the main
1:04:12
activity right main mean this one this main sorry not this this one okay now
1:04:18
let's check whether it's working fine or
1:04:24
not right now let's back here it's working fine now if you go click course
1:04:30
registration app go here if you click course uh why it's not displaying what's
1:04:35
the problem uh what is the problem here it's not loading
1:04:41
here why it's empty let's back to our code uh view do java here uh here we
1:04:47
have to add the additional line here so that's a problem right we have to write
1:04:52
array adapter equal new
1:04:57
uh array adapter so write like this we didn't pass the list view that's the problem
1:05:04
right r dot layout dot support this one we have to
1:05:10
add it uh after that what I'm going to do is comma t titles this is the this
1:05:16
titles right we have to add it here this one we have to give here as uh list view
1:05:22
right list one this one should be the list view one dot set adapter you have to pass it
1:05:29
this one this adapter array adapter C to copy control paste here Right now let's
1:05:35
check whether it's working fine or
1:05:43
not it's working fine here it's working fine right here it's working fine right
1:05:49
now what I'm going to see after that I'm going to do the edit and delete part right so if you click this button it
1:05:56
goes for the edit right so how to task we'll see right so what I'm going to do is here I'm going to do the another
1:06:03
thing is on this when you click the list view it goes to the page so here we have
1:06:08
write in this view part we have write another thing is array
1:06:14
adapter adapter dot notify data changed after that write list
1:06:23
one dot invalid views after that we have to write the on method here list view
1:06:31
list one listener one uh we have write the set method set
1:06:39
uh set on item click listener this one
1:06:45
new adapter view on click listener right here we have to write the thing is uh
1:06:50
first we have to write here is uh string string we have to write the
1:06:57
variables create a equal You have to write
1:07:03
titles titles dot get you have to write
1:07:10
position you have to get the positions uh after that list uh you have to write here is title get position dot two
1:07:18
string first one we have right after that what I'm going to see we have to get this one co this one co right you
1:07:26
have to get it here copyr paste here you have to create the object
1:07:32
C equal list dot get
1:07:40
so we have to write the
1:07:46
position after that type here
1:07:52
intent I equal new
1:07:58
intent get application context comma edit
1:08:05
right we have to create another activity here edit right we have to create another activity edit so select this one
1:08:11
new write empty activity edit sorry not basics you select as
1:08:22
empty edit right click
1:08:27
finish right your empty activity has been created successfully right here it's creating
1:08:34
right now here what I'm going to do is
1:08:39
say this one should be the view right okay here what I'm going to do is say comma at the
1:08:46
page edit dot class right now here first you have to
1:08:52
pass the details right I we have to write a intent new this one
1:08:59
I this I do put extra we have to send the value then you click edit button the selected
1:09:07
row should be passing to the relevant form okay first we have to show the data
1:09:14
into the form before edit right so here C dot
1:09:20
ID after that same thing you have to Ctrl C to copy ctrl V to paste here this
1:09:27
one should be course C
1:09:33
dot course after that C dot
1:09:39
C this one also C right finally we have write start
1:09:46
activity hi that's it that's the thing we have to do
1:09:52
right perfect that's the thing we have to do right now let's check whether it's
1:09:57
working fine or not right uh now we let's go to the edit
1:10:02
activity this edit one right this edit one right so let's
1:10:16
check right click course view click on this button it goes to the edit page right
1:10:23
this edit page right this edit page perfect right this go if you click this one it goes to the edit page for the
1:10:29
data right now what I'm going to do is here I'm going to uh do the edit part so
1:10:35
we have to uh do the change the form first right so let's go to the edit form
1:10:41
this is the edit one this edit part right this is very blank form here so here's a blank form now what I'm going
1:10:47
to do is here you go to your uh first course app form registration form
1:10:53
right activity main XML this one first form right so here the same design we have to get it here so what I'm going to
1:11:00
see you have to get it the same design so same layout right so first what I'm going to go to edit layout you have to
1:11:06
change this one as a linear
1:11:11
one here also you have to type orientation uh
1:11:16
vertical gravity center right after that what I'm going
1:11:23
to same design we have copy and paste it here the same
1:11:28
design everything same right the same thing right the it's
1:11:36
coming from here this layout to this layout fine layout right control to copy
1:11:41
back to edit control V to paste here see here same design is coming here this one
1:11:46
we have to change this one as here rest edit we have to change the heading as
1:11:51
simply this heading change the first heading app
1:11:57
edit delete this The thing we have to do
1:12:04
right now here right there that's the thing we have to do here course edit app edit delete right this is the form let's
1:12:11
visit perfect okay now what I'm going to do is here in this form I'm going to go
1:12:16
to the Java Java file is edit form go here this is the design part this is the
1:12:23
code part right so code part we have to get the all the files right so how many
1:12:30
things available here three text box field one button but we need two buttons to design right so back to here because
1:12:37
this one should be edit another one is for the delete so we have only one button there so we this one should be
1:12:44
make as edit we need another button ctrl C to copy control V to paste below B2
1:12:50
BTN2 this one should be delete if you want to change the color
1:12:56
of that you'll be able to change the color different color you can give background color you have to give here
1:13:02
as primary or dark this one or primary that will give as primary right you can
1:13:09
change the uh format right look like this perfect now what I'm going to say simply
1:13:16
uh we have to pass the data uh from the view page to here right uh from the view
1:13:23
page to edit page so when the when you click the uh data from the uh list view
1:13:30
the selected row data should be passing to this form for edit or delete right so
1:13:37
what I'm going to do is here go to the edit we first we have to do the edit part after that after done the edit part
1:13:43
we have to go for the delete part so first we have to edit text we have to write t1
1:13:51
ed2 ed3 right after that what I'm going to do is here b sorry ed3
1:14:05
button BT B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B 1 comma B2 all right perfect
1:14:11
now here what I'm going to do you have to assign the relevant fields ED1 find view by id the same thing you
1:14:19
have to put it here the same thing main go to the main activity here the same
1:14:25
add part what you wrote here the same ID so we have copy the same thing so C to copy same thing you have to paste it
1:14:32
here instead of typing again by again same ID also available because we are copying from the same uh registration
1:14:38
form that's why the same field names are same right Right so only we have to get the edit part is button button two is
1:14:45
not added in the registration part you have to add the button only right so
1:14:50
find view by id dot id dot btn two that will be the button
1:14:59
two right that's perfect now what I'm going to do is here first what I'm going
1:15:05
to say here is this one first one should be the part so we have to set on click
1:15:10
listener new view on click listener right perfect now here we have to write
1:15:15
the uh function for edit the data so this so before the edit we have to view the page data should be view the page so
1:15:22
we have to write here write intent I equal get intent okay here first we
1:15:33
have to view the data we have to create the string variable id equal I dot
1:15:40
get string xar here we have to write as a
1:15:45
id dot to string right okay the these values are
1:15:52
coming from which page this view on java page here we are sending the value here when the user click the data right here
1:16:00
when you click the data of Here course up field there will be the row which row you have to edit or delet the data click
1:16:08
on this view so here this edited data you should be passing to the edit page
1:16:13
so ID course and free these values are sending to which page edit page we are
1:16:19
returning the data to here returning the data and passing this relevant variable so we have to get it same thing C copy
1:16:26
control V to paste here right this second one should be course third one should be
1:16:32
fee right here this one should be the course this one should be the
1:16:37
fee that's it that's the stuff you have to do after that we are passing the
1:16:43
relevant text box fields so ED1 dot set x same like Java
1:16:50
ed ID right same thing control Copy control V paste here two this one should
1:16:55
be three right this one should be course C to copy control V paste here this one
1:17:01
should be control C copy control V right this all the passing to the 11 text box
1:17:07
now right now let's check whe after after done the stuff we have
1:17:13
to go for the edit code right so let's run and run the project and
1:17:23
check right now here I'm going to click view here I'm going to this data i'm
1:17:28
going to edit click on this one here it's successfully visit the page right here if you click this one it's
1:17:34
successfully visit the page if you click it's successfully visit the page the data is uh coming from the page
1:17:39
successfully now we'll be able to edit and delete the data that stuff we have to do here right after that what I'm
1:17:47
going to do is we go back to my uh insert my main activity so here this
1:17:53
add code we have to copy this a function we have copy all
1:17:59
things right okay ctrl C to copy the same thing go to the edit page we have
1:18:05
to paste them here right we have to paste it here so
1:18:10
here we have copy control X to cut off this one we have to paste it here after this back is entered this
1:18:18
back and here you have to paste the function this is a function okay now there's no error right okay okay yeah
1:18:24
after this uh backup backup are very important stuff right okay after this
1:18:29
backup right okay right yeah this button is uh here starting here close it here
1:18:36
after done this button you have to paste it here this one should be the function this one should be the not edit uh add
1:18:42
this one this one you have to change it as update so all the connection should be the same we only we have to do the
1:18:49
thing we have to change the uh coil part only other stuff are same right ed2 ed3
1:18:56
right ed1 mean ID ed2 mean uh see name fee right here like this okay here we
1:19:03
have to not going to edit the data we are we have to update the data so what I'm going to see get the ID and update
1:19:09
the data so we have to write the update code simply here prepare statement you have to write
1:19:15
here update you write update code you have just update which table you going to update the record you have to update
1:19:20
the table this registration table Reg table
1:19:26
right set which table firstly I'll set the
1:19:32
table as co table co name sorry C name not co name this
1:19:40
table mean C name equal into question mark comma C equal question mark
1:19:48
comma comma where how to Sorry not question mark uh comma here final here
1:19:55
is where id get the ID C ID sorry C id equal question mark C ID mean this C ID
1:20:03
get the ID and which ID you are retrieving get the ID and update the record this how we have to write the update query the first question mark
1:20:09
mean C name C name is this one so we have to pass first one should be the C name C to copy B past second one should
1:20:17
be the C second question mark should be the C so C to copy control B past how to
1:20:23
update the V C I get the C id control C copy V third one should take C I get
1:20:28
that done and here here update success right this is the thing we have to do these are called as prepare
1:20:35
statement right first question mark mean this first field mean this field goes here see C name I'm going to set it
1:20:43
second one C third one out update the record get the ID because why I get the
1:20:48
ID and update the record is ID should be unique so that uh update query should We
1:20:53
have done by the ID unique id right perfect right now let's check whether
1:20:59
it's working fine or not right after this function ctrl C to copy paste in
1:21:05
this button right when you click this button button this function will be work right all the stuff right now let's
1:21:21
check click I'm going to change the course for 12,000 click edit update success now
1:21:29
let's check check registration fee here 12,000
1:21:34
will be there i'm going to edit this code i'm going to change this one as a
1:21:42
C# C click edit button update it now let's
1:21:47
check your game you have to refresh it here C# right it's working fine right
1:21:53
it's working fine now I'm going to go to do another stuff is we have to we didn't clear the third text box so we have to
1:21:59
control C to copy control V to paste here third one you should be clear here right we didn't clear the third text box
1:22:05
so that ED3 is not clear so you have to write ED3 dot text right perfect okay
1:22:11
this CD3 also and also to copy the same thing you have to put it here as well here also I didn't put clear the third
1:22:18
text box right the registration form as well right this insert data right
1:22:23
finally we have to do the task office is go to the edit here finally we have to do the stuff is second part is a delete
1:22:30
button right delete part we have to do the delete part insert the edit part is working fine after that I'm going to do
1:22:37
the delete part so we designed the button here as well this is the button we have designed so here
1:22:43
we delete right so this so what I'm going to go to the edit on Java page i
1:22:49
have get the button BT1 dot here so we have to like get the button B2 dot set
1:22:56
on new view all press enter key we should be generated here what I'm going
1:23:03
the same code we have to copy control C to
1:23:10
copy the same code we have to control C copy control V to paste below this one
1:23:15
we have to change it as delete delete this one change it as delete all the suffer name here we have
1:23:22
to change this one this no need this things also no need this only thing we get the ID what's the ID should be there
1:23:30
what's the ID should be the here something like what ID should be there get the ID and delete the enter if you
1:23:36
click delete button what is ID the relevant row should be deleted right that's the only thing we have so that we
1:23:42
need only the ID text box column only so we have write the code simply very simple code we have write here delete
1:23:48
column outright is Okay delete which table are you going to
1:23:54
delete the record i'm going to delete the record uh delete from which table r table where are uh C ID coming from here
1:24:05
question mark it's coming from this one c I here only the one this one one sorry
1:24:11
not two one right get the ident here delete success get the message delete
1:24:16
success simple okay very simple one you have to do right
1:24:22
okay now here this function Ctrl C to copy you have to paste it the second
1:24:28
button this button right this thing you have to do right now let's check whether
1:24:34
it's working fine or not second
1:24:41
one right click course save i'm going to go to delete this record click on this
1:24:47
one so click delete delete successfully here it's delete successfully it goes here you have to refresh again go click
1:24:54
here here it delete successfully if you going to delete this one click here delete delete successfully it goes here
1:25:00
if you go to click here it's refreshing right perfect it's working perfect now you going to you will be able to add the
1:25:06
records also well here I'm going to add the record ID 10 here write I'm going to
1:25:11
write uh write here as Android fee
1:25:18
10,000 click add successfully now you'll be able to check here and right I hope you guys you
1:25:27
understood the Android Studio and SQL server database how to connect and how
1:25:33
to uh do the simple credit operation system in uh my uh SQL server and
1:25:40
Android uh while you doing the project if you get any doubts you will uh you
1:25:45
you can comment me I will here to answer thank you for watching if you like my
1:25:50
channel please subscribe me like me thank you for watching
#Windows & .NET