Moving project from one destinantion to other

Posted by Jopito under ASP.NET on 10/30/2013 | Points: 10 | Views : 932 | Status : [Member] | Replies : 8
Hellow pals,i need assistance on this situation.I have been able to develop my project well using asp.net.I need to implement it for use in another location not in my pc.I have used sql database as the backend.Now , how can i take it to other location for it to use the the same database as i tried to use it on another location but it would not interact with database.Thanks.

Mark as answer if satisfied


Responses

Posted by: Bandi on: 10/30/2013 [Member] [MVP] Platinum | Points: 25

Up
0
Down
How you connected with database.. ? Post us the SqlConnection set up
Are you able to connect with the database in another system using SQL Server Management Studio?


Mark This Response as Answer
--
Chandu
http://www.dotnetfunda.com/images/dnfmvp.gif

Jopito, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jopito on: 10/30/2013 [Member] Starter | Points: 25

Up
0
Down

This is how i have connected it with my databse

Dim con As New SqlConnection("Data Source=JOB94-PC\SQLEXPRESS;Initial Catalog=New Hotel;Integrated Security=True")
con.Open()
Dim com As New SqlCommand("Insert into Registration(Firstname,Lastname,Age,Username,Nationality,Telephone,Email,Gender,Maritalstatus,Password,Confirmpassword) values(@fnme,@lnme,@age,@usernme,@nationality,@telephone,@email,@gender,@maritalstatus,@pwd,@confirmpwd)", con)
com.Parameters.AddWithValue("@fnme", Txtfme.Text)
com.Parameters.AddWithValue("@lnme", Txtlname.Text)
com.Parameters.AddWithValue("@age", Txtage.Text)
com.Parameters.AddWithValue("@usernme", Txtusernme.Text)
com.Parameters.AddWithValue("@nationality", Txtnationality.Text)
com.Parameters.AddWithValue("@telephone", Txttelephon.Text)
com.Parameters.AddWithValue("@email", Txtemail.Text)
com.Parameters.AddWithValue("@gender", Drpdwnstatus.SelectedValue)
com.Parameters.AddWithValue("@maritalstatus", Rdbgender.SelectedValue)
com.Parameters.AddWithValue("@pwd", Txtpwd.Text)
com.Parameters.AddWithValue("@confirmpwd", Txtconfirmpwd.Text)
If (com.ExecuteNonQuery()) Then
Response.Write("Registration Succesfull")


End If
con.Close()

End Sub

Mark as answer if satisfied

Jopito, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jopito on: 10/30/2013 [Member] Starter | Points: 25

Up
0
Down
Dim con As New SqlConnection("Data Source=JOB94-PC\SQLEXPRESS;Initial Catalog=New Hotel;Integrated Security=True")
con.Open()
Dim com As New SqlCommand("Insert into Registration(Firstname,Lastname,Age,Username,Nationality,Telephone,Email,Gender,Maritalstatus,Password,Confirmpassword) values(@fnme,@lnme,@age,@usernme,@nationality,@telephone,@email,@gender,@maritalstatus,@pwd,@confirmpwd)", con)
com.Parameters.AddWithValue("@fnme", Txtfme.Text)
com.Parameters.AddWithValue("@lnme", Txtlname.Text)
com.Parameters.AddWithValue("@age", Txtage.Text)
com.Parameters.AddWithValue("@usernme", Txtusernme.Text)
com.Parameters.AddWithValue("@nationality", Txtnationality.Text)
com.Parameters.AddWithValue("@telephone", Txttelephon.Text)
com.Parameters.AddWithValue("@email", Txtemail.Text)
com.Parameters.AddWithValue("@gender", Drpdwnstatus.SelectedValue)
com.Parameters.AddWithValue("@maritalstatus", Rdbgender.SelectedValue)
com.Parameters.AddWithValue("@pwd", Txtpwd.Text)
com.Parameters.AddWithValue("@confirmpwd", Txtconfirmpwd.Text)
If (com.ExecuteNonQuery()) Then
Response.Write("Registration Succesfull")

End If
con.Close()

End Sub

Mark as answer if satisfied

Jopito, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Bandi on: 10/30/2013 [Member] [MVP] Platinum | Points: 25

Up
0
Down
hi,
Dim con As New SqlConnection("Data Source=JOB94-PC\SQLEXPRESS;Initial Catalog=New Hotel;Integrated Security=True")


Integrated Security=True means windows authentication.
By this option you can able to access in the local computer...


1) Create UserName and password for the SQL server instance
2) Use username and password as follows. Then you can able to connect from another system...
SqlConnection("Data Source=JOB94-PC\SQLEXPRESS;Initial Catalog=New Hotel;User Id=myUsername;Password=myPassword; ")


To create login for a database in SQL server:
http://www.katieandemil.com/sql-server-2012-add-user-login-with-sql-server-authentication

Mark This Response as Answer
--
Chandu
http://www.dotnetfunda.com/images/dnfmvp.gif

Jopito, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jopito on: 10/30/2013 [Member] Starter | Points: 25

Up
0
Down
Have read the link you have provided me with it,Now i have created a user to access the database,explain to me kindly that link from his machine and the database in my pc how i will connect to it.Thats the next part kindly i need to know.What do i need to configure from his machine an also my machine for them to work


Mark as answer if satisfied

Jopito, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Bandi on: 10/30/2013 [Member] [MVP] Platinum | Points: 25

Up
0
Down
Hi,
First create login for your database (JOB94-PC\SQLEXPRESS; Database:New Hotel) from your system.

Then use those credentials in the code of SqlConnection

Mark This Response as Answer
--
Chandu
http://www.dotnetfunda.com/images/dnfmvp.gif

Jopito, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jopito on: 10/30/2013 [Member] Starter | Points: 25

Up
0
Down
I have now created the login part,,Can you direct me now on how i will implement the connection path between my client to access the db in my pc
Thanks

Mark as answer if satisfied

Jopito, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Bandi on: 10/30/2013 [Member] [MVP] Platinum | Points: 25

Up
0
Down
NOTE: Before attempting this code make sure that you able to login to your database from another system ( with the help of user name and password).If you get any error while making connection through SQL Server Management Studio post us back the error message...


Now change your code by including user Id and password in the connection... that is enough

Dim con As New SqlConnection("Data Source=JOB94-PC\SQLEXPRESS;Initial Catalog=New Hotel;User ID=LoginName;Password=YourPassword ")
con.Open()
Dim com As New SqlCommand("Insert into Registration(Firstname,Lastname,Age,Username,Nationality,Telephone,Email,Gender,Maritalstatus,Password,Confirmpassword) values(@fnme,@lnme,@age,@usernme,@nationality,@telephone,@email,@gender,@maritalstatus,@pwd,@confirmpwd)", con)
com.Parameters.AddWithValue("@fnme", Txtfme.Text)
com.Parameters.AddWithValue("@lnme", Txtlname.Text)
com.Parameters.AddWithValue("@age", Txtage.Text)
com.Parameters.AddWithValue("@usernme", Txtusernme.Text)
com.Parameters.AddWithValue("@nationality", Txtnationality.Text)
com.Parameters.AddWithValue("@telephone", Txttelephon.Text)
com.Parameters.AddWithValue("@email", Txtemail.Text)
com.Parameters.AddWithValue("@gender", Drpdwnstatus.SelectedValue)
com.Parameters.AddWithValue("@maritalstatus", Rdbgender.SelectedValue)
com.Parameters.AddWithValue("@pwd", Txtpwd.Text)
com.Parameters.AddWithValue("@confirmpwd", Txtconfirmpwd.Text)
If (com.ExecuteNonQuery()) Then
Response.Write("Registration Succesfull")

End If
con.Close()

End Sub


Mark This Response as Answer
--
Chandu
http://www.dotnetfunda.com/images/dnfmvp.gif

Jopito, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response