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

R

RAB

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
 
G

Guest

Do 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] = strValue;
//i++;
}
//this.UpdateData(dSet);

Hope that helps,

Jason Lind
 
M

MamaKike

RAB said:
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
 
R

RAB

Is this code using VB?

Would you sample code be part of the SQL statement?

Thanks,
RABMissouri
 
M

MamaKike

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top