Inserting into Access Database won't work ASP.NET C#

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Here is my code. Im not sure if its the connection string or if its the insert command string which is the problem.
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small <font size="2" color="#0000ff" style="color:#0000ff; font-size:x-small
using
</font>
<span style="font-size:x-small System;
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small <font size="2" color="#0000ff" style="color:#0000ff; font-size:x-small
using
</font>
<span style="font-size:x-small System.Data;
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small <font size="2" color="#0000ff" style="color:#0000ff; font-size:x-small
using
</font>
<span style="font-size:x-small System.Configuration;
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small <font size="2" color="#0000ff" style="color:#0000ff; font-size:x-small
using
</font>
<span style="font-size:x-small System.Collections.Generic;
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small <font size="2" color="#0000ff" style="color:#0000ff; font-size:x-small
using
</font>
<span style="font-size:x-small System.Linq;
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small <font size="2" color="#0000ff" style="color:#0000ff; font-size:x-small
using
</font>
<span style="font-size:x-small System.Web;
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small <font size="2" color="#0000ff" style="color:#0000ff; font-size:x-small
using
</font>
<span style="font-size:x-small System.Web.Security;
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small <font size="2" color="#0000ff" style="color:#0000ff; font-size:x-small
using
</font>
<span style="font-size:x-small System.Web.UI;
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small <font size="2" color="#0000ff" style="color:#0000ff; font-size:x-small
using
</font>
<span style="font-size:x-small System.Web.UI.HtmlControls;
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small <font size="2" color="#0000ff" style="color:#0000ff; font-size:x-small
using
</font>
<span style="font-size:x-small System.Web.UI.WebControls;
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small <font size="2" color="#0000ff" style="color:#0000ff; font-size:x-small
using
</font>
<span style="font-size:x-small System.Web.UI.WebControls.WebParts;
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small <font size="2" color="#0000ff" style="color:#0000ff; font-size:x-small
using
</font>
<span style="font-size:x-small System.Xml.Linq;
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small <font size="2" color="#0000ff" style="color:#0000ff; font-size:x-small
using
</font>
<span style="font-size:x-small System.Data.OleDb;
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small <font size="2" color="#0000ff" style="color:#0000ff; font-size:x-small
public
</font>
<span style="font-size:x-small <span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small partial<span style="font-size:x-small
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small class<span style="font-size:x-small
<span style="color:#2b91af; font-size:x-small <span style="color:#2b91af; font-size:x-small register<span style="font-size:x-small : System.Web.UI.<span style="color:#2b91af; font-size:x-small

<span style="color:#2b91af; font-size:x-small Page


<span style="font-size:x-small
{
<font size="2" style="font-size:x-small

</font><span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small protected<span style="font-size:x-small
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small void<span style="font-size:x-small Page_Load(<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small object<span style="font-size:x-small
sender, <span style="color:#2b91af; font-size:x-small <span style="color:#2b91af; font-size:x-small EventArgs<font size="2 e)</font><span style="font-size:x-small
{
}
<font size="2" style="font-size:x-small

</font><span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small protected<span style="font-size:x-small
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small void<span style="font-size:x-small Button1_Click(<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small object<span style="font-size:x-small
sender, <span style="color:#2b91af; font-size:x-small <span style="color:#2b91af; font-size:x-small EventArgs<font size="2 e)</font><span style="font-size:x-small
{
<font size="2" style="font-size:x-small

</font><span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small string<font size="2 user = TextBox1.Text;</font><span style="font-size:x-small <font size="2" style="font-size:x-small

</font><span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small string<font size="2 pass = TextBox2.Text;</font><span style="font-size:x-small <font size="2" style="font-size:x-small

</font><span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small string<font size="2 email = TextBox4.Text;</font><span style="font-size:x-small <font size="2" style="font-size:x-small

</font><span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small string<span style="font-size:x-small connString =
<span style="color:#a31515; font-size:x-small <span style="color:#a31515; font-size:x-small @"Provider=Microsoft.ACE.OLEDB.12.0; Data Source=C:/Users/i2ilaptop/Documents/Visual Studio 2008/Projects/YquestionUs/App_Data/Members.accdb"<font size="2 ;</font><span style="font-size:x-small <font size="2" style="font-size:x-small

</font><span style="color:#2b91af; font-size:x-small <span style="color:#2b91af; font-size:x-small OleDbConnection<span style="font-size:x-small conn =
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small new<span style="font-size:x-small
<span style="color:#2b91af; font-size:x-small <span style="color:#2b91af; font-size:x-small OleDbConnection<font size="2 (connString);</font><span style="font-size:x-small
conn.Open();
<font size="2" style="font-size:x-small

</font><span style="color:#2b91af; font-size:x-small <span style="color:#2b91af; font-size:x-small OleDbCommand<font size="2 cmd = conn.CreateCommand();</font><span style="font-size:x-small <font size="2" style="font-size:x-small
cmd.CommandText =
</font><span style="color:#a31515; font-size:x-small <span style="color:#a31515; font-size:x-small "INSERT INTO [users] ([username], [password], )"<font size="2 +</font><span style="font-size:x-small <font size="2" style="font-size:x-small

</font><span style="color:#a31515; font-size:x-small <span style="color:#a31515; font-size:x-small "VALUES("<span style="font-size:x-small + user +
<span style="color:#a31515; font-size:x-small <span style="color:#a31515; font-size:x-small ", "<span style="font-size:x-small + pass +
<span style="color:#a31515; font-size:x-small <span style="color:#a31515; font-size:x-small ", "<span style="font-size:x-small + email +
<span style="color:#a31515; font-size:x-small <span style="color:#a31515; font-size:x-small ")"<font size="2 ;</font><span style="font-size:x-small

cmd.ExecuteNonQuery();
conn.Close();

}
<font size="2" style="font-size:x-small

</font><span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small protected<span style="font-size:x-small
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small void<span style="font-size:x-small Button1_Click1(<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small object<span style="font-size:x-small
sender, <span style="color:#2b91af; font-size:x-small <span style="color:#2b91af; font-size:x-small EventArgs<font size="2 e)</font><span style="font-size:x-small
{
}
}


[url=http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/cb273026-bc7b-4805-a896-bcac84e7c5c6]View the full article[/url]
 

Similar threads

A
Replies
0
Views
165
ANIL AYDINALP
A
D
Replies
0
Views
107
Donald Uko
D
R
Replies
0
Views
140
Rajat Bajpai
R
K
Replies
0
Views
226
Khan345
K
Back
Top