|
Hi Dear,
How to connect MS Access database using ASP.net
regards
adil
|
|
|
|
|
Hello Adil,
you can use OleDbConnection, for e.g
using System.Data.OleDb;
//...
//...
//...
OledbConnection conn = new OleDbConnection("your connection string here");
//...
but maybe you should be more specific. what exactly do you want to do with the data? bind to a grid?...
Also, what version of Asp.Net
acodeisacodeisacode
|
|
|
|
|
hi dear
I was trying to use following code ..but it is not working properly.
Imports System.Data.OleDb
Public Class Form1 Inherits System.Windows.Forms.Form
Dim cn As OleDbConnection
Dim cmd As OleDbCommand
Dim dr As OleDbDataReader
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e as _
System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As_
System.EventArgs) Handles Button1.Click
Try
cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;_
Data Source=C:\emp.mdb;")
'provider to be used when working with access database
cn.Open()
cmd = New OleDbCommand("select * from table1", cn)
dr = cmd.ExecuteReader
While dr.Read()
TextBox1.Text = dr(0)
TextBox2.Text = dr(1)
TextBox3.Text = dr(2)
' loading data into TextBoxes by column index
End While
Catch
End Try
dr.Close()
cn.Close()
End Sub
End Class
regards
adil
|
|
|
|
|
Standard question #1:
What do you mean by "not working"?
Standard question #2:
What error message do you get?
---
single minded; short sighted; long gone;
|
|
|
|
|
Hi Adil,
You said something about ASP.Net but it looks like it is a windows form you are dealing with. Anyhow, it doesn't matter.
What you can do is put a breakpoint in your code for the Button click event
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As_
System.EventArgs) Handles Button1.Click
then step though the code and find out where it breaks. This would give us info enough to help you.
Meanwhile, i expect that the database has a table, Table1 with at least 3 fields that are all of Text type (?).
(gain maybe it would help for you to go with:
TextBox1.Text = dr(0).ToString().....etc
acodeisacodeisacode
|
|
|
|
|
Hi all,
I am using a datagrid to display employee information such as Name,grade,dept,expertise... My problem is that the expertise column goes on expanding and the text wraps and everything`s spoiled.I want that if the length of the column increase the extra information be shown by using onmouseover on that cell of datagrid. How do i dothis in itemcreated event of datagrid
|
|
|
|
|
1.Use template column for particular field
<asp:TemplateColumn HeaderText="Office Location">
<ItemTemplate>
<div class="divstyleNormal"><%#DataBinder.Eval(Container.DataItem , "Location")%></div>
</ItemTemplate>
</asp:TemplateColumn>
CSS refered for the above is
.divstyleNormal
{
overflow: hidden;
width: 175px;
}
This way you can cut the text, and while binding(ItemDataBound) you can set the tool tip
Regards,
Sylvester G
Senior Software Engineer
Xoriant Solutions
sylvester_g_m@yahoo.com
|
|
|
|
|
Please need help on building a web search engine with c#.net got some note but haven't read them yet. want to get much idea so i can work and sort them out offline .
shawn414
|
|
|
|
|
shawn414 wrote: Please need help on building a web search engine with c#.net got some note but haven't read them yet. want to get much idea so i can work and sort them out offline .
This is such a vague question I don't know where to start. What, specifically, are you stuck with? Database design? Database interaction? internet protocols? Parsing of web pages? and so on...
|
|
|
|
|
there are good articles in the articles on this site that will assist you.
do a search for web spiders in the articles.
but as angus says there is alot of detail you need to consider, and as exactly what do you mean by search engine? are you looking to incorporate a full text search on your web site? search engine can mean so many things in this world!
|
|
|
|
|
I'm having a problem with this peice of code and for the life of me I cant figure out why. If I run it as a C# application on my computer it will send an email to the testaddress@gmail.com containing the text "HI!" ... When I copy this code into my Asp.Net applictation and run it on the server I get the error shown below the code... The server version is also shown. Any ideas would be very welcome as I've been trying to make this work for several hours now!
<br />
protected void Button1_Click(object sender, EventArgs e)<br />
{<br />
MailMessage message = new MailMessage("mailer@testdomain.com", "testaddress@gmail.com", "feedback", "HI!");<br />
SmtpClient mailClient = new SmtpClient("mail.testdomain.com");<br />
<br />
mailClient.Port = 25;<br />
mailClient.UseDefaultCredentials = false;<br />
mailClient.Credentials = new NetworkCredential("mailer@testdomain.com", "test");<br />
mailClient.DeliveryMethod = SmtpDeliveryMethod.Network;<br />
<br />
mailClient.Send(message);<br />
<br />
<br />
<br />
message.Dispose();<br />
}<br />
Server Error in '/' Application.<br />
--------------------------------------------------------------------------------<br />
<br />
The SMTP server requires a secure connection or the client was not authenticated. The server response was: PLESK.home ESMTP MailEnable Service, Version: 1.95-- denied access at 02/18/07 02:02:23 <br />
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. <br />
<br />
Exception Details: System.Net.Mail.SmtpException: The SMTP server requires a secure connection or the client was not authenticated. The server response was: PLESK.home ESMTP MailEnable Service, Version: 1.95-- denied access at 02/18/07 02:02:23<br />
<br />
Source Error: <br />
<br />
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. <br />
<br />
Stack Trace: <br />
<br />
<br />
[SmtpException: The SMTP server requires a secure connection or the client was not authenticated. The server response was: PLESK.home ESMTP MailEnable Service, Version: 1.95-- denied access at 02/18/07 02:02:23]<br />
System.Net.Mail.SmtpConnection.GetConnection(String host, Int32 port) +819256<br />
System.Net.Mail.SmtpTransport.GetConnection(String host, Int32 port) +316<br />
System.Net.Mail.SmtpClient.GetConnection() +42<br />
System.Net.Mail.SmtpClient.Send(MailMessage message) +2004<br />
Email.Button1_Click(Object sender, EventArgs e) +153<br />
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105<br />
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107<br />
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7<br />
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11<br />
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33<br />
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102<br />
<br />
<br />
<br />
<br />
--------------------------------------------------------------------------------<br />
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.210
Thank you in advance,
Curt
|
|
|
|
|
hetrobezz wrote: The SMTP server requires a secure connection or the client was not authenticated.
I think you'll find your answer in there.
|
|
|
|
|
Hi friends,
I am facing a typical problem in crystal reports i made an application in aspnet2005 using crystal reports i have made n tier system the database is on one server and application is on one server the problem is i have to restart the application server daily in order to view crystal report if i am not doing so i cant see the report in the viewer only blank page is seen can anybody help me.
regards jabbar
jabbarsb
|
|
|
|
|
I'm looking for sample code (AJAX, ASP, JAVA) that allows web users to input questions from a form and when submitted it calls a document (Word, PDF, HTML) and inputs the users answers in the appropriate location of the document and allows them to print the document. Is this possible and what is the best code to use (AJAX, ASP, JAVASCRIPT, PERL)???
Thanks...
JR
|
|
|
|
|
Anythings possible.
AJAX and Javascript probably won't do it (Javascript is client side and Ajax is basically a javascript technology).
It'll be possible with any server-side language, you'll just need a library to write to your document format. HTML is of course easy, PDF theres plenty of libraries available to write to it (I've seen ones for Java, .NET and PHP has several built in). Word I'm not sure about, your only option there may be .NET with Word installed on the server (you can then download the Word interop libraries which make it easy to use Word from within a .NET program)
|
|
|
|
|
Thanks for reply, I would like to try something easy (HTML, PDF) Do you have a sample sript I could use to modify for my needs? I simply want the web visitors inputs from a web form to be placed in a document (it does not matter what type, html, pdf, word I will work with what is ever easier at this point. Their answers will be placed in the document at various locations. Whats the easiest script to use?
Thanks for the help...
|
|
|
|
|
Hi, I'm trying to set the background color for certain listitems in my radiobuttonlist control.
The rbtnl control is inside a repeater. So, for each question, populate x amount of questions.
I want an incorrect answer to have a red background and the correct answer a blue background.
I'm able to set the background colors but I'm not able to set them to the same width since the
listitems correspond to html spans and not tablecells. It will obviously only highlight as
far as the actual text goes. Any ideas?
Here's the code so far:
protected void rpt_questions_OnItemDataBound(object sender, RepeaterItemEventArgs e) {
if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem)) {
... not important code;
DataRowView drv = e.Item.DataItem as DataRowView;
if (drv != null) {
rbtnl_answers.DataTextField = "answer";
rbtnl_answers.DataValueField = "id";
rbtnl_answers.DataSource = drv.CreateChildView("answers");
rbtnl_answers.DataBind();
rbtnl_answers.SelectedValue = choice;
// choice = chosen answer's id
if (choice.Length > 0) {
foreach (ListItem li in rbtnl_answers.Items) {
if ((li.Value == choice) && (correct != choice)) {
li.Attributes["style"] += "background-color: red; color: white;";
}
else if (li.Value == correct) {
li.Attributes["style"] += "background-color: blue; color: white;";
}
}
}
}
|
|
|
|
|
Hi Friends
Please help me out in this situation,
how to open a word template (contain bookmark) from asp.net and vb.net 2003 version.
Functionality when user to generate the template to place bookmark values from sql server db table to be insert into that word document and ask the user to open, save option dialog box as result.
Need urgent please help me
Thanks
Good Heart
-- modified at 13:06 Sunday 18th February, 2007
|
|
|
|
|
Haribabu Krishnamurthy wrote: Need as soon as Possible
How did that work out for you?
only two letters away from being an asset
|
|
|
|
|
Assalam-O-Alaikum ! Dear friends i want to provide email facility at my Web site... when i click on send button, message dispaly "Email has sent" but not deleiverd. Please tell me whats problem.... my code is:
Dim SMTP As New Net.Mail.SmtpClient("185.250.70.125", 80)
Dim Message As New Net.Mail.MailMessage
SMTP.Credentials = New Net.NetworkCredential("mailto@daily-aaj.com", "outgoing")
Message.To.Add("ferozeahmed1@hotmail.com")
Message.From = New Net.Mail.MailAddress("fm_love82@hotmail.com", "itsme")
Message.Sender = New Net.Mail.MailAddress("fm_love82@hotmail.com", "itsme")
Message.Body = "This is a sample mail to test the SMTP Service"
SMTP.Send(Message)
Label6.Text = "Mail has been sent to " & "ferozeahmed1@hotmail.com"
feroze
|
|
|
|
|
If you are sure that there is no error in sending then you should check your email in JunkBox.. Your email might be there..
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message. Thank you.
|
|
|
|
|
mail was not in my junk mail too... any other issue?
feroze
|
|
|
|
|
fmlove wrote: Dim SMTP As New Net.Mail.SmtpClient("185.250.70.125", 80)
Are you sure the smtp server is at port 80? Port 80 is usually for http. What happens if you use port 25? Or if you do not specify a port at all?
Wout Louwers
|
|
|
|
|
Thanks for reply dear! yes port is correct and when i use port 25 Failure sending messages display and when do not specify a port same error display
Ferzoe
|
|
|
|
|
I notice your code does not specify an authentication type. This might help:
MailMessage message = new MailMessage(myEmail, myEmail, "subject1", "body1");
// SmtpClient is used to send the e-mail
SmtpClient mailClient = new SmtpClient(smtpServerName);
mailClient.UseDefaultCredentials = false;
CredentialCache myCache = new CredentialCache();
myCache.Add(smtpServerName, 25, "Basic", new NetworkCredential(myUserName, myPassword));
mailClient.Credentials = myCache;
// Send delivers the message to the mail server
mailClient.Send(message);
|
|
|
|