473,396 Members | 1,767 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

how i can remove conn.open error?

i am making a website on asp.net using C# i have connected access database and used this coding:
[codes]

using System;
using System.Data.OleDb;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Default2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void Button1_Click(object sender, EventArgs e)
{
String Query = "Select meaning from words where word like '%" + TextBox1.Text + "%'";
String Query2 = "Select mufrid from words where word like '%" + TextBox1.Text + "%'";

String strConn = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\MUFRIDAT_UL_QURAN1.mdb;Persist Security Info=False";



OleDbConnection Conn = new OleDbConnection(strConn);
Conn.Open();
OleDbDataReader dr = null;
OleDbCommand cmd = new OleDbCommand(Query, Conn);
dr = cmd.ExecuteReader();
while (dr.Read() == true)
{
TextBox2.Text = (dr["meaning"].ToString());
}

dr = null;
cmd = new OleDbCommand(Query2, Conn);
dr = cmd.ExecuteReader();
while (dr.Read() == true)
{
TextBox3.Text = (dr["mufrid"].ToString());
}
Conn.Close();
}
}
[/codes]

Now, two error are occured first on conn.open();
and second on cmd = new OleDbCommand(Query2, Conn);
plz help me to remove this error.
Dec 23 '10 #1
0 1195

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: BlackSun | last post by:
most of my rpts don't open even in design mode open with VB gives 2501 error, that should be a sendobject error (related w email...) have you any clue? Access 2003
4
by: Thomas Scheiderich | last post by:
The following code works fine. It opens file reads the data and then closes. **************************************************************************** **************** Dim objFileInfo As...
1
by: liju | last post by:
Hi, I am facing a problem while trying to execute a simple mdx query using C# and OLEDB conn. The code I am using is as: // Create a OleDb(!!)-connection OleDbConnection oleDbConn = new...
3
by: FC | last post by:
Hello All: I am getting the following error: Compiler Error Message: CS0246: The type or namespace name 'conn' could not be found (are you missing a using directive or an assembly reference?) ...
8
by: someone | last post by:
I'm making an program that encodes text, and then writes it into another text file. The problem is that I can't seem to get the "file exists" checking right. If I use the command (coder is the...
0
by: Jeff | last post by:
I'm still a bit new to vb.net using visual studio 2005, so bare with me if this question isn't well worded. On a rare occasion, my application will throw an error that I haven't yet tracked down...
2
by: M K | last post by:
I got this error and have no clue what to do. Error code( -2146232060 ) An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure...
2
by: Zuhaib Hyder | last post by:
please remove double quote error in accessing javascript variable in c# , Page.RegisterStartupScript("MyScript", "<script language=javascript> var thumb = null;thumb =...
1
by: R04 | last post by:
i was trying to connect to Oracle10, but "Connction string should be opened " error message is getting displayed..herz the Code Snippet..Can any one suggest me an Solution string oradb = "Data...
7
by: simritsaini1982 | last post by:
hello.. Can anybody tell me how to remove the linker error as mentioned above.. i have created a simple program in C++ as given below #include<iostream.h> #include<conio.h> class ABC { ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.