Sunday, February 19, 2012

GridView...Problem

I m creating the project in asp.net using c# and vb languages in 2005.

I have used the asp standard controls(with table<td><tr>) and gridview to design the form.

I m using sqldatasource to insert and update data from sql server 2005.

I have written the following code

<script runat="server">
Private Sub Page_Load()
If Not Request.Form("SUBMIT") Is Nothing Then
srccompany.Insert()
End If
End Sub
</script>

<asp:SqlDataSource
id="srccompany"
SelectCommand="SELECT * FROM companymaster"
InsertCommand="INSERT companymaster(companyname)
VALUES (@.companyname)"

UpdateCommand="UPDATE companymaster SET companyname=@.companyname WHERE companyid=1"
DeleteCommand="DELETE companymaster WHERE companyname=@.companyname"
ConnectionString="<%$ ConnectionStrings:companymaster %>"
Runat="server">
</asp:SqlDataSource>

<asp:GridView
id="GridCompanyMaster"
DataSourceID="srccompany"
Runat="server" />

Please help me to insert the data in sql server.i m not been able to insert the data is there any problem in coding..

Also i m not been able to edit the data and store back to sql server.

Only i can do is i can view the contents in gridview

Please give me some tips

Try writing:

insertinto

No comments:

Post a Comment