Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 VB and SQL

Author  Topic 

albertkohl
Aged Yak Warrior

740 Posts

Posted - 2007-04-03 : 15:20:44
okay, so i'm trying to connect to an sql server and run a query that copies data from one table into a new one called working.

i know that would probably be better answered at a VB Fourm, but i'm guessing you guys work with this stuff all the time. any assistance would be great.

below is what i already have,

        Dim dashDataSource As New SqlDataSource()
dashDataSource.ConnectionString = ConfigurationManager.ConnectionStrings("TestConnectionString1").ToString()

dashDataSource.SelectCommandType = SqlDataSourceCommandType.Text
dashDataSource.SelectCommand = "select * into working from results where oo_mtg_amnt>=100"





before i go any further, i wanted to make sure it's correct, i basically want to copy anything matching the above criteria into the "WORKING" table. sound right? it does connect to the server and all. so i'm assuming so.

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-04-03 : 15:24:16
Define "anything".
Indexes, triggers and foreign keys will not be copied. Only data and DDL.


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

albertkohl
Aged Yak Warrior

740 Posts

Posted - 2007-04-03 : 15:26:10
just the fields, i dont need indexes or anything, after i'm finished running a few scripts on the table, it will be dropped. and most quantities will be small anyway.
Go to Top of Page

albertkohl
Aged Yak Warrior

740 Posts

Posted - 2007-04-03 : 16:54:59
Oh, and by the way, i'm using visual web developer 2005.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-04-03 : 17:06:23
Yes, in that case it will work.


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

albertkohl
Aged Yak Warrior

740 Posts

Posted - 2007-04-03 : 17:12:59

okay, well then here is the next thing below is the list of code following this, i get a parameter error at: rowsaffected = dashDataSource.Select() what am i missing? any ideas?



Dim rowsaffected As Integer = 0

Try
rowsaffected = dashDataSource.Select()
Catch ex As Exception
Server.Transfer("newsletter_problem.aspx")
Finally
dashDataSource = Nothing
End Try


If rowsaffected <> 1 Then
Server.Transfer("Newsletter_problem.aspx")
Else
Server.Transfer("Newsletter_confirm.aspx")
End If

Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-04-03 : 17:15:09
dashDataSource.EXECUTE() ???



Peter Larsson
Helsingborg, Sweden
Go to Top of Page

albertkohl
Aged Yak Warrior

740 Posts

Posted - 2007-04-03 : 17:16:38
you think i should replace rowsaffect=dashdatasource.execute()? or your saying i'm missing that (i'm SOOO an amature at this)
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-04-03 : 17:18:37
I think you must EXECUTE your statement with some kind of method. I guess it is a .EXECUTE() method.
You know you have access to the developer help files, right? Press F1.
They provide tons of examples and syntax help...


Peter Larsson
Helsingborg, Sweden
Go to Top of Page
   

- Advertisement -