Showing posts with label access. Show all posts
Showing posts with label access. Show all posts

Thursday, March 29, 2012

pop3 access help

Hello,

Does ASP.NET support pop3 access. I would like to read a pop3 account. If not does anyone know of any good free pop3 asp.net components. I am using asp.net vb if this makes any difference

Thanks

Granthttp://www.google.be/search?q=cache:uhM2afinXZAJ:www.codeproject.com/useritems/POP3Library.asp+C%23+pop3+codeproject&hl=nl&ie=UTF-8

http://www.google.be/search?q=cache:01fZDLtY80QJ:www.codeproject.com/csharp/pop3client.asp+C%23+pop3+codeproject&hl=nl&ie=UTF-8

google is your friend :)

Monday, March 26, 2012

Populate A Dropdown From Another Dropdown

I have a page that has two dropdowns on it. When the page loads, the first box is populated from an Access table. Here's the tricky part for me...

(Just when I think I understand how "postback" works, I find I'm wrong again!)

I have the dropdown set to autopostback=true. When the user selects a choice in this dropdown, the page postsback (I think) and I want it to then query another table in the same database to fill the second dropdown list AND keep the original dropdown list's selection.

For some reason, I can get it to fill the original dropdown, but then when it postsback, I get an error because my SQL statement to load the second dropdown looks like this:

Dim objSeriesDA As New OleDb.OleDbDataAdapter("SELECT * FROM Series WHERE fldProviderID=" & lstProvider.SelectedItem.Value & " ORDER BY fldSeriesNumber DESC", objSeriesCN)

Apparently, when the page postsback, the original dropdown list loses its selection, causing the SQL statement above to error out on a null reference.

Any ideas?

If need be, I can throw this up on a server so you all can see what I'm talking about... I can post the full source as well.

Thanks!

HWKY
:)wrap the code that is filling your first drop down list with this:

If Not Page.IsPostBack Then
'...your code here.
End If
Does anyone have a link to some information that explains PostBack in depth?
well, this link (http://www.15seconds.com/Issue/020102.htm) helped me with some basics on the page lifecycle when i was having user control postback problems. Really, there's not much more to the kind of postback stuff in your first post. If you know how the page loads and when control events are evaluated, that's pretty much it. Were you looking for information on how to roll your own PostBack handler or something else?

Wednesday, March 21, 2012

populating a drop down box with ms access information

what is the best way to populate a drop down box with a list of names in a database? i'm using webmatrix/asp.net and the names are in a field called "name" .

dim ConnString as string = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=MyDBPath;"
dim conn As System.Data.OleDb.OleDbConnection(ConnString)
dim cmd As New OleDb.OleDbCommand()
dim dr as OleDb.OleDbDataReader
cmd.connection = conn
cmd.CommandType = CommandType.Text
cmd.CommandText = "select id, name from mytable"
try
conn.open
dr = cmd.executereader() 'assuming dr is your datareader
myDropDownList.datasource = dr
myDropDownList.DataTextField = "name"
myDropDownList.DataValueField = "id" 'example of assinging a value field too
myDropDownList.Databind()
finally
conn.close
end try

This is an example using a datareader for quick access and ideal for dropdownlists. You will see examples using datasets too but this just happens to be my preference from a performance point of view.

populating a dropdown with stored procedure in ms access

hallo,

I'm trying to populate a dropdown by using a stored procedure in an access db, but what I get is completely empty dropdown. Am I doing something wrong?

this is the code I'm using:

code-behind:

Private function BindArchive()
dim myConnection as new OleDBConnection ("Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=C:\inetpub\wwwroot\new1\db.mdb")
dim objCmd_archive as OleDbCommand = new OleDbCommand ("Query1", myConnection)
objCmd_archive.CommandType = CommandType.StoredProcedure
myConnection.Open()
Return objCmd_archive.ExecuteReader()
myConnection.Close()
End Function

dropdown control:

<form runat="server">
<asp:DropDownList id="cbo_archive" DataSource="<%# BindArchive() %>" DataTextField="mes_date" DataTextValue="mes_date" runat="server" />
</form>

thanks for suggestions

I highly recommend against using this function for getting the data. The reason is that you are exiting the function before closing the database, which you should never do and which means that the database won't be closed. You need to assign the DataReader to the DDL's DataSource in your CodeBehind. For example:

Page_Load(...)

...

myConnection.Open()

cbo_archive.DataSource = objCmd_archive.ExecuteReader();

cbo_archive.DataBind();

myConnection.Close.

End

Furthermore, it is best practice to place you database activity within aTry/Catch/Finally block, where you close the database connection in the Finally section.

Friday, March 16, 2012

populating an access database used for ASP.net website...

I want to populate my access database with strings which are coded as
follows:

{
{"string1"},
{"string2"},
{"string3"},
.....
{"string100"},
{"string101"},
}

I have 200 of these string lists that I want to populate an access data
base. I am building a website using ASP.net.

Without having to copy and paste each string individually, is there
anything I could do that would be simpler and faster?

Thanks,
RABMissouriDo each of these strings belong in the same field (ie: one row per string) or
the same row (one field per row).

The first is safer for what I'm about to describe, because then you don't
have to worry about the data matching up, but either is fine.

You can write something like:
int i = 0;
foreach(string strValue in array)
{
this.AddValue(strValue);
//dSet[0][i] = strValue;
//i++;
}
//this.UpdateData(dSet);

Hope that helps,

Jason Lind

"RAB" wrote:

> I want to populate my access database with strings which are coded as
> follows:
>
> {
> {"string1"},
> {"string2"},
> {"string3"},
> .....
> {"string100"},
> {"string101"},
> }
> I have 200 of these string lists that I want to populate an access data
> base. I am building a website using ASP.net.
> Without having to copy and paste each string individually, is there
> anything I could do that would be simpler and faster?
> Thanks,
> RABMissouri
>
"RAB" wrote:
>I want to populate my access database with strings which are coded as
>follows:
>
>{
> {"string1"},
> {"string2"},
> {"string3"},
> .....
> {"string100"},
> {"string101"},
>}
>I have 200 of these string lists that I want to populate an access data
>base. I am building a website using ASP.net.
>Without having to copy and paste each string individually, is there
>anything I could do that would be simpler and faster?
>Thanks,
>RABMissouri

you can always create a for cicle to do that

for x=0 to 200
insert "string" & x
next

--
Sent via .NET Newsgroups
http://www.dotnetnewsgroups.com
Is this code using VB?

Would you sample code be part of the SQL statement?

Thanks,
RABMissouri

MamaKike wrote:
> "RAB" wrote:
> >I want to populate my access database with strings which are coded as
> >follows:
> >{
> > {"string1"},
> > {"string2"},
> > {"string3"},
> > .....
> > {"string100"},
> > {"string101"},
> >}
> >I have 200 of these string lists that I want to populate an access data
> >base. I am building a website using ASP.net.
> >Without having to copy and paste each string individually, is there
> >anything I could do that would be simpler and faster?
> >Thanks,
> >RABMissouri
> you can always create a for cicle to do that
> for x=0 to 200
> insert "string" & x
> next
>
> --
> Sent via .NET Newsgroups
> http://www.dotnetnewsgroups.com
I'm going to try to put an example

Imagine that you have a database table named xpto with only a field
named exp. And you want to write in exp your strings
string1...string200

dim dtaConnection as New SqlConnection("integrated security=SSPI;data
source=(local);persist security info=False;initial catalog=xpto")
dim strSql as string
Dim comand As New SqlCommand(strSQL, dtaConnection)
comand.CommandType = CommandType.Text

dtaConnection.Open()
for i as integer=0 to 200
sql="Insert into exp values (" & i &")"
comand.ExecuteNonQuery()
next
dtaConnection.Close()

to use oledb change SQL to oledb

--
Sent via .NET Newsgroups
http://www.dotnetnewsgroups.com

populating an access database used for ASP.net website...

I want to populate my access database with strings which are coded as
follows:
{
{"string1"},
{"string2"},
{"string3"},
....
{"string100"},
{"string101"},
}
I have 200 of these string lists that I want to populate an access data
base. I am building a website using ASP.net.
Without having to copy and paste each string individually, is there
anything I could do that would be simpler and faster?
Thanks,
RABMissouriDo each of these strings belong in the same field (ie: one row per string) o
r
the same row (one field per row).
The first is safer for what I'm about to describe, because then you don't
have to worry about the data matching up, but either is fine.
You can write something like:
int i = 0;
foreach(string strValue in array)
{
this.AddValue(strValue);
//dSet[0][i] = strValue;
//i++;
}
//this.UpdateData(dSet);
Hope that helps,
Jason Lind
"RAB" wrote:

> I want to populate my access database with strings which are coded as
> follows:
>
> {
> {"string1"},
> {"string2"},
> {"string3"},
> .....
> {"string100"},
> {"string101"},
> }
> I have 200 of these string lists that I want to populate an access data
> base. I am building a website using ASP.net.
> Without having to copy and paste each string individually, is there
> anything I could do that would be simpler and faster?
> Thanks,
> RABMissouri
>
"RAB" wrote:
>I want to populate my access database with strings which are coded as
>follows:
>
>{
> {"string1"},
> {"string2"},
> {"string3"},
> .....
> {"string100"},
> {"string101"},
>}
>I have 200 of these string lists that I want to populate an access data
>base. I am building a website using ASP.net.
>Without having to copy and paste each string individually, is there
>anything I could do that would be simpler and faster?
>Thanks,
>RABMissouri
>
you can always create a for cicle to do that
for x=0 to 200
insert "string" & x
next
Sent via .NET Newsgroups
http://www.dotnetnewsgroups.com
Is this code using VB?
Would you sample code be part of the SQL statement?
Thanks,
RABMissouri
MamaKike wrote:
> "RAB" wrote:
> you can always create a for cicle to do that
> for x=0 to 200
> insert "string" & x
> next
>
> --
> Sent via .NET Newsgroups
> http://www.dotnetnewsgroups.com
I'm going to try to put an example
Imagine that you have a database table named xpto with only a field
named exp. And you want to write in exp your strings
string1...string200
dim dtaConnection as New SqlConnection("integrated security=SSPI;data
source=(local);persist security info=False;initial catalog=xpto")
dim strSql as string
Dim comand As New SqlCommand(strSQL, dtaConnection)
comand.CommandType = CommandType.Text
dtaConnection.Open()
for i as integer=0 to 200
sql="Insert into exp values (" & i &")"
comand.ExecuteNonQuery()
next
dtaConnection.Close()
to use oledb change SQL to oledb
Sent via .NET Newsgroups
http://www.dotnetnewsgroups.com