hey frnds, tell me one thing as in VB.Net suppose if we want to connnect to SQL,then in form coding itself.We create the database,Create table ...& insert values...

WE do that cz if we run the project at Client side,even if no database is there our project automatically creates it So that no error is there,Is it also possible in ASP.net...

Is yes,can somebody tell me from where to start...

Comments

Tell me if this helps.....

<script languae="PHP">
	open_database("location","username","password");
	display_page("PAGE_ID");
	close_database();
</script>
Comments
php? really?
php for asp.net ?

Hi

This is not a recommended solution... it's not a good programming practice... the maintenance would be a big issue as you move in development stage.

Try keep n-tier architecture.
1) keep db as separate with ur scripts
2) Dataaccess layer
3) business layer
4) presentation layer

This will create a table named "Test123"

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
		Dim conn As SqlClient.SqlConnection = New SqlClient.SqlConnection("Data Source=APEX2006SQL;Initial Catalog=ServManLeather;Integrated Security=True")
		conn.Open()
		Dim cmd As SqlClient.SqlCommand = New SqlClient.SqlCommand("Create Table Test123 ( someColumn varchar(123) )", conn)
		cmd.ExecuteNonQuery()
		cmd.Dispose()
		conn.Close()
		conn.Dispose()
	End Sub
This article has been dead for over six months. Start a new discussion instead.