hai ,
i am trying to do online railway reservation project.

In that project.if we give the source and destination station .it should give the number of tickets available,class name ,train name and time &
in that form itself we have a reservation link.if any one reserved, the number of tickets should reduced accordingly and stored in the database.

i want to know how to retrive the data from database to form.
and how to update the database.(give me some source to learn about this because i am starter in vb.net)

i am using sql data adapter and sql connection which statement should used.

thank you

Recommended Answers

All 13 Replies

Which code editor are you using?

Code to Retrieve Data using Select Command

Imports System.Data.SqlClient
Public Class Form1 Inherits System.Windows.Forms.Form
Dim myConnection As SqlConnection
Dim myCommand As SqlCommand
Dim dr As New SqlDataReader()
'declaring the objects

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)_
Handles MyBase.Load
myConnection = New SqlConnection("server=localhost;uid=sa;pwd=;database=pubs")
'establishing connection. you need to provide password for sql server
Try
myConnection.Open()
'opening the connection
myCommand = New SqlCommand("Select * from discounts", myConnection)
'executing the command and assigning it to connection
dr = myCommand.ExecuteReader()
While dr.Read()
'reading from the datareader
MessageBox.Show("discounttype" & dr(0).ToString())
MessageBox.Show("stor_id" & dr(1).ToString())
MessageBox.Show("lowqty" & dr(2).ToString())
MessageBox.Show("highqty" & dr(3).ToString())
MessageBox.Show("discount" & dr(4).ToString())
'displaying the data from the table
End While
dr.Close()
myConnection.Close()
Catch e As Exception
End Try
End Sub

End Class

Code to Retrieve Data using Select Command

Imports System.Data.SqlClient
Public Class Form1 Inherits System.Windows.Forms.Form
Dim myConnection As SqlConnection
Dim myCommand As SqlCommand
Dim dr As New SqlDataReader()
'declaring the objects

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)_
Handles MyBase.Load
myConnection = New SqlConnection("server=localhost;uid=sa;pwd=;database=pubs")
'establishing connection. you need to provide password for sql server
Try
myConnection.Open()
'opening the connection
myCommand = New SqlCommand("Select * from discounts", myConnection)
'executing the command and assigning it to connection
dr = myCommand.ExecuteReader()
While dr.Read()
'reading from the datareader
MessageBox.Show("discounttype" & dr(0).ToString())
MessageBox.Show("stor_id" & dr(1).ToString())
MessageBox.Show("lowqty" & dr(2).ToString())
MessageBox.Show("highqty" & dr(3).ToString())
MessageBox.Show("discount" & dr(4).ToString())
'displaying the data from the table
End While
dr.Close()
myConnection.Close()
Catch e As Exception
End Try
End Sub

End Class

Which code editor are you using?

hai,

i am doing the project using vb.net

Code to Retrieve Data using Select Command

Imports System.Data.SqlClient
Public Class Form1 Inherits System.Windows.Forms.Form
Dim myConnection As SqlConnection
Dim myCommand As SqlCommand
Dim dr As New SqlDataReader()
'declaring the objects

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)_
Handles MyBase.Load
myConnection = New SqlConnection("server=localhost;uid=sa;pwd=;database=pubs")
'establishing connection. you need to provide password for sql server
Try
myConnection.Open()
'opening the connection
myCommand = New SqlCommand("Select * from discounts", myConnection)
'executing the command and assigning it to connection
dr = myCommand.ExecuteReader()
While dr.Read()
'reading from the datareader
MessageBox.Show("discounttype" & dr(0).ToString())
MessageBox.Show("stor_id" & dr(1).ToString())
MessageBox.Show("lowqty" & dr(2).ToString())
MessageBox.Show("highqty" & dr(3).ToString())
MessageBox.Show("discount" & dr(4).ToString())
'displaying the data from the table
End While
dr.Close()
myConnection.Close()
Catch e As Exception
End Try
End Sub

End Class

thank u sir

hai,
i want to make a project on online railway reservation in vb.net.please give me details about this project. How can i interact with internet using windows application in this project?

hai,
i want to make a project on online railway reservation in vb.net.please give me details about this project. How can i interact with internet using windows application in this project?

Hi, you can develop de user interfaces in aspx, the way you can interact with it is throug the database, you have to make different proyects in one solution.

hai,
please give me full details about my project of online railway reservation in vb.net.what should be included in this project and also give its source code.

Cant be that specific ritika, theres a lot of coding to build a solution, tell me what do you have so far and then I can help

please give me full details about my project of online railway reservation in vb.net.what should be included in this project and also give its source code.

You just described the completed project. I don't think anyone is going to do it all for you without some kind of payment. :D

what material should be included in online railway reservation

i am doing online railway reservation project in vb.net.this project is windows based.but i want to take this project on internet by making this project on windows. how can i do?

in this project i include train schedule in which i include train id,train name source,destination,arrival time and departure time in one line in this i include a radiobutton with each train id when user clicks on any train id ,it dispay all information about that train .please tell me how can i retreive data from database when user click on any radiobutton please give me its source code i am using oracle as backend.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.