Answered by:
OleDbException

Question
-
User-183221118 posted
OleDbConnection
con1 = new OleDbConnection("Provider = Microsoft.Jet.OLEDB.4.0;data source=H://WebSite2/database/Database1.mdb;persist security info=false"
);
String insertcmd = @"INSERT INTO TPD(T_ID,T_name,T_desg,T_dep,T_email,T_cont,T_gen) Values(stnm,stnm, stbr, stdpt, stem, stct, stgn)"
;
con1.Open();
OleDbCommand cmd1 = new OleDbCommand
(insertcmd, con1);
cmd1.ExecuteNonQuery();
con1.Close();
Error Show at con1? what i Do
Friday, July 22, 2011 10:19 AM
Answers
-
User-821857111 posted
or Acess 2007The connection string for an Access 2007 (accbd file) database is:
"Provider = Microsoft.ACE.OLEDB.12.0;data source=H://WebSite2/database/Database1.mdb"
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Monday, August 1, 2011 4:01 PM
All replies
-
User1366487642 posted
what the error? please give error message that you are getting..
Friday, July 22, 2011 11:44 AM -
User-183221118 posted
in database no entry shows
plz send solutiion as soon as possible
error occour ASM??
Friday, July 22, 2011 9:48 PM -
User-183221118 posted
Error is: : Could not find installable ISAM.
Friday, July 22, 2011 10:00 PM -
User3866881 posted
Hello OP:)
Change your db connstr to this——
Provider = Microsoft.Jet.OLEDB.4.0;data source=H:\\WebSite2\\database\\Database1.mdb;persist security info=false
Sunday, July 24, 2011 4:00 AM -
User1698673233 posted
KAILASHASERISGNR HI,
CHANGE YOUR CONNECTION
String sConn = "provider=sqloledb;server=(local)\\SQLEXPRESS;database=MyDatabase;Integrated Security=SSPI"; OleDbConnection oConn = new OleDbConnection(sConn); oConn.Open();
THANKS
Sunday, July 24, 2011 3:15 PM -
User-1199946673 posted
CHANGE YOUR CONNECTION
String sConn = "provider=sqloledb;server=(local)\\SQLEXPRESS;database=MyDatabase;Integrated Security=SSPI"; OleDbConnection oConn = new OleDbConnection(sConn); oConn.Open();
SQL Express??? He is using a MDB file...
Sunday, July 24, 2011 6:13 PM -
User-183221118 posted
i also try this but could not work
now i make data base in sql2000 and using visual studio 2010.
my code does not work no error comes to me?
but no updation on data base.
is that any one have a sample of connecting database (SQL2000 or Acess 2007 using VS2010)plz send me!!!!!!!
this my code:::
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Web;
using
System.Web.UI;
using
System.Web.UI.WebControls;
using
System.Data;
//SQL Database
using
System.Data.SqlClient;
//SQL Database
public
partial class Default4 : System.Web.UI.
Page
{
protected void Page_Load(object sender, EventArgs
e)
{
}
SqlConnection
con;
SqlCommand
cmd;
protected void Button1_Click(object sender, EventArgs
e)
{
string Query1;
//Query String
// Textbox1 is Student id
Query1 =
"INSERT INTO SPD (S_ID,S_name,S_branch,S_dept,S_email,S_cont,S_gen) VALUES ('" + TextBox1.Text + "','" + TextBox1.Text + "','" + DropDownList1.SelectedItem + "','" + DropDownList2.SelectedItem + "''" + TextBox4.Text + "','" + TextBox5.Text + "','" + RadioButton1.Text + "')"
;
con =
new SqlConnection("Server=.;Database=Data;uid=sa;pwd=sa;");
//Connection String
cmd =
new SqlCommand
(Query1, con);
con.Open();
//Connection Open Here
try
{
cmd.ExecuteNonQuery();
//Execute Query
con.Close();
// Close Connection
}
catch (SqlException
ex)
{
Response.Write(ex.Message);
}
Response.Redirect(
"Default.aspx"
);
}
protected void ImageButton1_Click(object sender, ImageClickEventArgs
e)
{
}
protected void Button2_Click(object sender, EventArgs
e)
{
//string stnm, stbr, stdpt, stem, stct, stgn, stedug, stedgd, stedpg, stum, stuug, stugd, stupg, stprm, stprug, stprgd, stprpg, stpym, stpyug, stpygd, stpypg, stspm, stspug, stspgd, stsppg;
//stnm = TextBox1.Text;
//stbr = DropDownList1.SelectedValue;
//stdpt = DropDownList2.SelectedValue;
//stem = TextBox4.Text;
//stct = TextBox5.Text;
//stgn=RadioButton1.Text;
//stedug = TextBox23.Text;
//stedgd = TextBox24.Text;
//stedpg = TextBox25.Text;
//stum = TextBox7.Text;
//stuug = TextBox11.Text;
//stugd = TextBox12.Text;
//stupg = TextBox13.Text;
//stprm = TextBox8.Text;
//stprug = TextBox14.Text;
//stprgd = TextBox15.Text;
//stprpg = TextBox16.Text;
//stpym = TextBox9.Text;
//stpyug = TextBox17.Text;
//stpygd = TextBox18.Text;
//stpypg = TextBox19.Text;
//stspm = TextBox10.Text;
//stspug = TextBox20.Text;
//stspgd = TextBox21.Text;
//stsppg = TextBox22.Text;
//Response.Write(stnm + stbr + stdpt + stem + stct + stgn + stedug + stedgd + stedpg + stum + stuug + stugd + stupg + stprm + stprug + stprgd + stprpg + stpym + stpyug + stpygd + stpypg + stspm + stspug + stspgd + stsppg);
}
protected void TextBox18_TextChanged(object sender, EventArgs
e)
{
}
}
Saturday, July 30, 2011 6:49 AM -
User3866881 posted
Hello again:)
Your codes seem to be right in logic. So have you checked what's in your db?
It's an inserting statement instead of an update one, I think.
Sunday, July 31, 2011 8:50 PM -
User-821857111 posted
or Acess 2007The connection string for an Access 2007 (accbd file) database is:
"Provider = Microsoft.ACE.OLEDB.12.0;data source=H://WebSite2/database/Database1.mdb"
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Monday, August 1, 2011 4:01 PM