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
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment