Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Nov 27, 2012 04:25 AM by nikunjnandaniya
Nov 22, 2012 05:53 AM|LINK
I have some table in database. I want to modify that table need to modify data in only one column using aspx.vb
Please help me in this, how can i modify already existing database?
Nov 22, 2012 06:10 AM|LINK
Use gridview - sqldatasource, autogenerate insert/update/delete
set some column readonly.
Nov 22, 2012 06:14 AM|LINK
Grid vied i dont know how to use.
I am new for .NET :(
Please provide some link for help or some Code
Nov 26, 2012 07:09 PM|LINK
You need to explain us bit more, like which connection you have used in your application such as ADO.Net, Entity Framework or LINQ TO SQL, how you are populating data on page.
Here is how you can do using ADO.Net. Preferably use the Stored procedure to update. But if this is for your test then u can direclty write query. I assume you have a asp.net page which has text boxes populated with data.
' Create database connection
Dim con as new new SqlConnection(@"Data Source=WNPCCSG03\SQL08;Initial Catalog=MiscTest;uid=sa;Password=CsgGr0up")
' create command object. Assign query and connection
dim cmd as new SqlCommand("update CustomerDetails set address=@Add where CustID=@CustID",con)
' Tell the command type, here you can select Storedprocedure and give SP name instead of above query
' Add two parameter as below which feed into above query
' Opecn connection, execute query and close connection
' data should updated into the DB
Note: I have quickly written code, just copy and paste to the code editor make changes where needed.
Nov 27, 2012 04:25 AM|LINK
you can use below code.
Dim Cmd As New SqlClient.SqlCommand
Using SqlConnection As New SqlClient.SqlConnection(Connectionstring)
Cmd.CommandType = CommandType.StoredProcedure
Cmd.CommandText = "tblProgressMonthStatusUpdate" ' Your Stored Procedure Name
Cmd.Parameters.Add("id", SqlDbType.Int).Value = idSession ' Your primary key
Cmd.Connection = SqlConnection
Catch ex As Exception
If Not Cmd Is Nothing Then
Cmd = Nothing
I considered that you know how to get connection string and how to make stored procedure.