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

  • Thread starter Thread starter RAB
  • Start date Start date
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
 
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
 
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
 
Is this code using VB?

Would you sample code be part of the SQL statement?

Thanks,
RABMissouri
 
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
 
Back
Top