Add new record to database using C# [modified]
-
I am asp programmer now I am updating my skills and learning ASP.net. I am using VS2005. using Accessdatasource I fetched records from database. But I am not able to find method to add records to Database.
modified on Wednesday, May 14, 2008 8:22 AM
-
I am asp programmer now I am updating my skills and learning ASP.net. I am using VS2005. using Accessdatasource I fetched records from database. But I am not able to find method to add records to Database.
modified on Wednesday, May 14, 2008 8:22 AM
-
That I can use but I am confused with connections. I used to use command for setting connection in asp here I am using Access datasource. So how I will define connectionname to my query. In add_subadmin.aspx I added 3 text boxes and onbutton click a function is called in default.aspx.cs file . Having this code. DataSet dataSet1 = new DataSet(); DataRow newCustomersRow = dataSet1.Tables["subadmin"].NewRow(); newCustomersRow["name"] = subname.Text; newCustomersRow["username"] = username.Text; newCustomersRow["password"] = password.Text; dataSet1.Tables["subadmin"].Rows.Add(newCustomersRow); error says: Compiler Error Message: CS0103: The name 'subname' does not exist in the current context Source Error: Line 22: DataRow newCustomersRow = dataSet1.Tables["subadmin"].NewRow(); Line 23: newCustomersRow["name"] = subname.Text; Line 24: newCustomersRow["username"] = username.Text; Line 25: newCustomersRow["password"] = password.Text;
-
That I can use but I am confused with connections. I used to use command for setting connection in asp here I am using Access datasource. So how I will define connectionname to my query. In add_subadmin.aspx I added 3 text boxes and onbutton click a function is called in default.aspx.cs file . Having this code. DataSet dataSet1 = new DataSet(); DataRow newCustomersRow = dataSet1.Tables["subadmin"].NewRow(); newCustomersRow["name"] = subname.Text; newCustomersRow["username"] = username.Text; newCustomersRow["password"] = password.Text; dataSet1.Tables["subadmin"].Rows.Add(newCustomersRow); error says: Compiler Error Message: CS0103: The name 'subname' does not exist in the current context Source Error: Line 22: DataRow newCustomersRow = dataSet1.Tables["subadmin"].NewRow(); Line 23: newCustomersRow["name"] = subname.Text; Line 24: newCustomersRow["username"] = username.Text; Line 25: newCustomersRow["password"] = password.Text;
-
Thanks a lot its really good article but its in VB.net I am looking for C# :doh:
-
Thanks a lot its really good article but its in VB.net I am looking for C# :doh: