i know how to exprot to pdf and i know how to use parameters but i dont know how to do both together.
Could some please help me. I have a parameter in the report called sbtcode and it is a string value. how can i pass it to the report?
Private Sub Command1_Click()
Dim appl As New CRAXDRT.Application
Dim rep As CRAXDRT.Report
rep.ExportOptions.DiskFileName = "c:\pdf_report.pdf"
rep.ExportOptions.DestinationType = crEDTDiskFile
rep.ExportOptions.FormatType = crEFTPortableDocFormat
rep.Export FalseThis code is from CR 8.5 and VB 6.
Private Sub Command1_Click()
Dim appl As New CRAXDRT.Application
Dim rep As CRAXDRT.Report
'This removes the prompt for the Parameter
rep.EnableParameterPrompting = False
'This sets the parameter to strValue
rep.ParameterFields(1).AddCurrentValue (strValue)
rep.ExportOptions.DiskFileName = "c:\pdf_report.pdf"
rep.ExportOptions.DestinationType = crEDTDiskFile
rep.ExportOptions.FormatType = crEFTPortableDocFormat
rep.Export False
Showing posts with label exprot. Show all posts
Showing posts with label exprot. Show all posts
Sunday, March 11, 2012
Wednesday, February 15, 2012
Export script data from sql server - suggestions for this case
Hello Guys,
I would like to export my database into a file in order to be used in
another server that I do not know? So, I would to be able to exprot
all the table structure, stored procedures and data (insert into).
How can I do it?
InaPerhaps you just need a database backup.
Ben Nevarez, MCDBA, OCP
Database Administrator
"ina" wrote:
> Hello Guys,
> I would like to export my database into a file in order to be used in
> another server that I do not know? So, I would to be able to exprot
> all the table structure, stored procedures and data (insert into).
> How can I do it?
> Ina
>|||Ben
She wanted as I understood her only table's structure without any data
So , he may want to use SQLDMO objects to script out or Generate Script
Option in the EM
Sub ScriptDB(strLogin As String, strPwd As String, _
strDataBase As String, StrFilePath As String)
Dim sql As Object
Dim db As Object
Dim objTrigger As Object
Dim intOptions As Long
Dim genObj
Set sql = CreateObject("SQLDMO.SQLServer")
Set db = CreateObject("SQLDMO.Database")
Set objTrigger = CreateObject("SQLDMO.Trigger")
Const sDrops As Integer = 1
Const sIncludeHeaders As Long = 131072
Const sDefault As Integer = 4
Const sAppendToFile As Integer = 256
Const sBindings As Integer = 128
' Set scripting options. Because you need to specify multiple behaviors
' for the ScriptType argument, you use "Or" to combine these.
intOptions = sDrops Or sIncludeHeaders Or _
sDefault Or sAppendToFile Or sBindings
' Connect to local server
sql.Connect "(local)", strLogin, strPwd
Set db = sql.Databases(strDataBase, "dbo")
' Script User Defined Data Types
For Each genObj In db.UserDefinedDatatypes
genObj.Script intOptions, StrFilePath
Next
' Script Tables and Triggers, ignoring system
' tables and system generated triggers
For Each genObj In db.Tables
If genObj.SystemObject = False Then
genObj.Script intOptions, StrFilePath
For Each objTrigger In genObj.Triggers
If objTrigger.SystemObject = False Then
objTrigger.Script intOptions, StrFilePath
End If
Next
End If
Next
' Script Rules
For Each genObj In db.Rules
genObj.Script intOptions, StrFilePath
Next
' Script Defaults
For Each genObj In db.Defaults
genObj.Script intOptions, StrFilePath
Next
' Script Sprocs, ignoring system sprocs
For Each genObj In db.StoredProcedures
If genObj.SystemObject = False Then
genObj.Script intOptions, StrFilePath
End If
Next
' Script Views, ignoring system views and informational schemas
For Each genObj In db.Views
If genObj.SystemObject = False Then
genObj.Script intOptions, StrFilePath
End If
Next
MsgBox "Finished generating SQL scripts."
End Sub
Save the module as MyModule.
Call ScriptDB("UserName","Password","DatabaseName","C:\MyResults.SQL")
"Ben Nevarez" <bnevarez@.sjm.com> wrote in message
news:03E4FC21-234C-42DF-BF2D-649922C22CE0@.microsoft.com...
> Perhaps you just need a database backup.
> Ben Nevarez, MCDBA, OCP
> Database Administrator
>
> "ina" wrote:
>> Hello Guys,
>> I would like to export my database into a file in order to be used in
>> another server that I do not know? So, I would to be able to exprot
>> all the table structure, stored procedures and data (insert into).
>> How can I do it?
>> Ina
>>|||thanks but I would like to data too (copy the backup only is a
solution). But this script is very cool. Thanks|||Use www.sqlscripter.com to generate the data scripts for tables.
"ina" wrote:
> Hello Guys,
> I would like to export my database into a file in order to be used in
> another server that I do not know? So, I would to be able to exprot
> all the table structure, stored procedures and data (insert into).
> How can I do it?
> Ina
>|||Thank you thomas. I will have a look on this tools.
Ina
Thomas wrote:
> Use www.sqlscripter.com to generate the data scripts for tables.
> "ina" wrote:
> > Hello Guys,
> >
> > I would like to export my database into a file in order to be used in
> > another server that I do not know? So, I would to be able to exprot
> > all the table structure, stored procedures and data (insert into).
> >
> > How can I do it?
> >
> > Ina
> >
> >
I would like to export my database into a file in order to be used in
another server that I do not know? So, I would to be able to exprot
all the table structure, stored procedures and data (insert into).
How can I do it?
InaPerhaps you just need a database backup.
Ben Nevarez, MCDBA, OCP
Database Administrator
"ina" wrote:
> Hello Guys,
> I would like to export my database into a file in order to be used in
> another server that I do not know? So, I would to be able to exprot
> all the table structure, stored procedures and data (insert into).
> How can I do it?
> Ina
>|||Ben
She wanted as I understood her only table's structure without any data
So , he may want to use SQLDMO objects to script out or Generate Script
Option in the EM
Sub ScriptDB(strLogin As String, strPwd As String, _
strDataBase As String, StrFilePath As String)
Dim sql As Object
Dim db As Object
Dim objTrigger As Object
Dim intOptions As Long
Dim genObj
Set sql = CreateObject("SQLDMO.SQLServer")
Set db = CreateObject("SQLDMO.Database")
Set objTrigger = CreateObject("SQLDMO.Trigger")
Const sDrops As Integer = 1
Const sIncludeHeaders As Long = 131072
Const sDefault As Integer = 4
Const sAppendToFile As Integer = 256
Const sBindings As Integer = 128
' Set scripting options. Because you need to specify multiple behaviors
' for the ScriptType argument, you use "Or" to combine these.
intOptions = sDrops Or sIncludeHeaders Or _
sDefault Or sAppendToFile Or sBindings
' Connect to local server
sql.Connect "(local)", strLogin, strPwd
Set db = sql.Databases(strDataBase, "dbo")
' Script User Defined Data Types
For Each genObj In db.UserDefinedDatatypes
genObj.Script intOptions, StrFilePath
Next
' Script Tables and Triggers, ignoring system
' tables and system generated triggers
For Each genObj In db.Tables
If genObj.SystemObject = False Then
genObj.Script intOptions, StrFilePath
For Each objTrigger In genObj.Triggers
If objTrigger.SystemObject = False Then
objTrigger.Script intOptions, StrFilePath
End If
Next
End If
Next
' Script Rules
For Each genObj In db.Rules
genObj.Script intOptions, StrFilePath
Next
' Script Defaults
For Each genObj In db.Defaults
genObj.Script intOptions, StrFilePath
Next
' Script Sprocs, ignoring system sprocs
For Each genObj In db.StoredProcedures
If genObj.SystemObject = False Then
genObj.Script intOptions, StrFilePath
End If
Next
' Script Views, ignoring system views and informational schemas
For Each genObj In db.Views
If genObj.SystemObject = False Then
genObj.Script intOptions, StrFilePath
End If
Next
MsgBox "Finished generating SQL scripts."
End Sub
Save the module as MyModule.
Call ScriptDB("UserName","Password","DatabaseName","C:\MyResults.SQL")
"Ben Nevarez" <bnevarez@.sjm.com> wrote in message
news:03E4FC21-234C-42DF-BF2D-649922C22CE0@.microsoft.com...
> Perhaps you just need a database backup.
> Ben Nevarez, MCDBA, OCP
> Database Administrator
>
> "ina" wrote:
>> Hello Guys,
>> I would like to export my database into a file in order to be used in
>> another server that I do not know? So, I would to be able to exprot
>> all the table structure, stored procedures and data (insert into).
>> How can I do it?
>> Ina
>>|||thanks but I would like to data too (copy the backup only is a
solution). But this script is very cool. Thanks|||Use www.sqlscripter.com to generate the data scripts for tables.
"ina" wrote:
> Hello Guys,
> I would like to export my database into a file in order to be used in
> another server that I do not know? So, I would to be able to exprot
> all the table structure, stored procedures and data (insert into).
> How can I do it?
> Ina
>|||Thank you thomas. I will have a look on this tools.
Ina
Thomas wrote:
> Use www.sqlscripter.com to generate the data scripts for tables.
> "ina" wrote:
> > Hello Guys,
> >
> > I would like to export my database into a file in order to be used in
> > another server that I do not know? So, I would to be able to exprot
> > all the table structure, stored procedures and data (insert into).
> >
> > How can I do it?
> >
> > Ina
> >
> >
Subscribe to:
Posts (Atom)