Showing posts with label access. Show all posts
Showing posts with label access. Show all posts

Friday, March 30, 2012

pros/cons of using Access 2003 as a front-end for SQL 2005

Hi,

I'm creating a SQL 2005 database for a small company. I'm leaning towards using Access 2003 as a front-end for them, since it has a decent report writer and the adp projects seem to preserve SQL's schema relationships.

But I've read some posts where Microsoft is frowning on adp projects. It would cost this company more money in the short-term, but am I better off building a custom .net winforms application instead and avoid Access 2003?

I've done a lot of asp.net coding, but not too much Access or WinForms...so I have a slight learning curve either way.

I've looked at some RAD Tools like Iron Speed Designer, but I'm not sure they'll spend the $$ on that and it seemed complicated to customize the generated code.

thanks,
Bruce
I would recommend to ask this question on access forum instead.

Pros and cons with table lock

I use an ole db destination which I simply use to insert data into database.
If it's configured to use Fast Load as access mode, then it is possible to switch on/off the Lock table property, which is set to true as default.

Are there any drawbacks with switching off the Lock table property? What do I gain when using it?

Thanks for your help!

Its a performance issue. Having a table lock means that the load process doesn't have to worry about lower level locks, and so the load should be quicker.
But it does mean no one else can use that table

Wednesday, March 28, 2012

Property IsPrimaryFile is not available for DataFile

I backup an SQL Server 2000 database (MY_DATABASE) and restore it in
SQLServer 2005.
Then, when I try to access its properties I get:
Property IsPrimaryFile is not available for DataFile '[MY_DATABASE]'. This
property may not exist for this object, or may not be retrievable due to
insufficient access rights. (Microsoft.SqlServer.Smo)
- I'm using a windows 2003 administrator account
- I tried setting compatibility level to 90 but it didn't help.
- If I connect with a sql-level user (not windows 2003 login) a can view the
properties, but I can't change anything.
Any ideas?
Thanks!http://www.dbtalk.net/microsoft-public-sqlserver-setup/copying-databse-sql-2000-sql-265404.html
"Gaspar" <Gaspar@.Gaspar.com> wrote in message
news:uOX2SbJaGHA.3612@.TK2MSFTNGP03.phx.gbl...
>I backup an SQL Server 2000 database (MY_DATABASE) and restore it in
>SQLServer 2005.
> Then, when I try to access its properties I get:
> Property IsPrimaryFile is not available for DataFile '[MY_DATABASE]'. This
> property may not exist for this object, or may not be retrievable due to
> insufficient access rights. (Microsoft.SqlServer.Smo)
> - I'm using a windows 2003 administrator account
> - I tried setting compatibility level to 90 but it didn't help.
> - If I connect with a sql-level user (not windows 2003 login) a can view
> the properties, but I can't change anything.
> Any ideas?
> Thanks!
>

Property IsPrimaryFile is not available for DataFile

I backup an SQL Server 2000 database (MY_DATABASE) and restore it in
SQLServer 2005.
Then, when I try to access its properties I get:
Property IsPrimaryFile is not available for DataFile '[MY_DATABASE]'. Th
is
property may not exist for this object, or may not be retrievable due to
insufficient access rights. (Microsoft.SqlServer.Smo)
- I'm using a windows 2003 administrator account
- I tried setting compatibility level to 90 but it didn't help.
- If I connect with a sql-level user (not windows 2003 login) a can view the
properties, but I can't change anything.
Any ideas?
Thanks!http://www.dbtalk.net/microsoft-pub...
l-265404.html
"Gaspar" <Gaspar@.Gaspar.com> wrote in message
news:uOX2SbJaGHA.3612@.TK2MSFTNGP03.phx.gbl...
>I backup an SQL Server 2000 database (MY_DATABASE) and restore it in
>SQLServer 2005.
> Then, when I try to access its properties I get:
> Property IsPrimaryFile is not available for DataFile '[MY_DATABASE]'.
This
> property may not exist for this object, or may not be retrievable due to
> insufficient access rights. (Microsoft.SqlServer.Smo)
> - I'm using a windows 2003 administrator account
> - I tried setting compatibility level to 90 but it didn't help.
> - If I connect with a sql-level user (not windows 2003 login) a can view
> the properties, but I can't change anything.
> Any ideas?
> Thanks!
>

Properties window closes abruptly - Flashes on for a second only.

I have a SQL 2000 server, SP3a, on a Windows 2000 server, SP4. When I
try to access the properties window of the server, it just flashes on
the screen for a second, and closes. Other applications with
properties type windows work fine, so it appears to be SQL related.
Any ideas would be greatly appreciated.Hello,
Thanks for your post. According to your description I understand that when
you try to access the properties window of SQL Server, the dialog just
flashes on the screen for a second and closes. This behavior is strange and
I would like you to provide more information so that I can fully understand
the problem.
1. What is the properties window of the SQL Server? Do you mean the
property dialog of SQL Server in Enterprise Manager?
2. Does this problem occur randomly? Can you reproduce this behavior?
3. If so, please describe the reproduce steps in detail so that I can try
to reproduce this behavior on my side.
I am looking forward to hearing from you soon.
Best regards,
Michael Shao
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Properties window closes abruptly - Flashes on for a second only.

I have a SQL 2000 server, SP3a, on a Windows 2000 server, SP4. When I
try to access the properties window of the server, it just flashes on
the screen for a second, and closes. Other applications with
properties type windows work fine, so it appears to be SQL related.
Any ideas would be greatly appreciated.Hello,
Thanks for your post. According to your description I understand that when
you try to access the properties window of SQL Server, the dialog just
flashes on the screen for a second and closes. This behavior is strange and
I would like you to provide more information so that I can fully understand
the problem.
1. What is the properties window of the SQL Server? Do you mean the
property dialog of SQL Server in Enterprise Manager?
2. Does this problem occur randomly? Can you reproduce this behavior?
3. If so, please describe the reproduce steps in detail so that I can try
to reproduce this behavior on my side.
I am looking forward to hearing from you soon.
Best regards,
Michael Shao
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Friday, March 23, 2012

Prompting connection str to access SQL server

Hi ,
my connection string is as per follows but how can i made it such that i
need not hard code the useid & pwd w/o having to create a user interface ?
tks & rdgs
Can you please send the connection string
best Regards,
Chandra
http://chanduas.blogspot.com/
"maxzsim" wrote:

> Hi ,
> my connection string is as per follows but how can i made it such that i
> need not hard code the useid & pwd w/o having to create a user interface ?
> tks & rdgs
|||As far as I understand - you must use trusted connection option and depend
on account that your application work with.
Bojidar Alexandrov
"maxzsim" <maxzsim@.discussions.microsoft.com> wrote in message
news:DD415C15-32D4-43DC-B9AC-5C44D08DC738@.microsoft.com...
> Hi ,
> my connection string is as per follows but how can i made it such that i
> need not hard code the useid & pwd w/o having to create a user interface ?
> tks & rdgs
|||That depends just on your application you code, there are serveral ways for
doing this:
Storing the password in a external storage (evtl. with encryption)
-registry
-xml file
-active directory
...
Using Windows Authentification:
http://msdn.microsoft.com/library/de...urity_47u6.asp
Using a DSN to connect with, (Has already a GUI ;-) )
But all that depends ont eh app you are coding the enviroment and so on..
HTH, Jens Suessmeyer.
http://www.sqlserver2005.de
"maxzsim" <maxzsim@.discussions.microsoft.com> schrieb im Newsbeitrag
news:DD415C15-32D4-43DC-B9AC-5C44D08DC738@.microsoft.com...
> Hi ,
> my connection string is as per follows but how can i made it such that i
> need not hard code the useid & pwd w/o having to create a user interface ?
> tks & rdgs

Prompting connection str to access SQL server

Hi ,
my connection string is as per follows but how can i made it such that i
need not hard code the useid & pwd w/o having to create a user interface ?
tks & rdgsCan you please send the connection string
--
best Regards,
Chandra
http://chanduas.blogspot.com/
---
"maxzsim" wrote:

> Hi ,
> my connection string is as per follows but how can i made it such that i
> need not hard code the useid & pwd w/o having to create a user interface ?
> tks & rdgs|||As far as I understand - you must use trusted connection option and depend
on account that your application work with.
Bojidar Alexandrov
"maxzsim" <maxzsim@.discussions.microsoft.com> wrote in message
news:DD415C15-32D4-43DC-B9AC-5C44D08DC738@.microsoft.com...
> Hi ,
> my connection string is as per follows but how can i made it such that i
> need not hard code the useid & pwd w/o having to create a user interface ?
> tks & rdgs|||That depends just on your application you code, there are serveral ways for
doing this:
Storing the password in a external storage (evtl. with encryption)
-registry
-xml file
-active directory
..
Using Windows Authentification:
http://msdn.microsoft.com/library/d...>
ity_47u6.asp
Using a DSN to connect with, (Has already a GUI ;-) )
But all that depends ont eh app you are coding the enviroment and so on..
HTH, Jens Suessmeyer.
http://www.sqlserver2005.de
--
"maxzsim" <maxzsim@.discussions.microsoft.com> schrieb im Newsbeitrag
news:DD415C15-32D4-43DC-B9AC-5C44D08DC738@.microsoft.com...
> Hi ,
> my connection string is as per follows but how can i made it such that i
> need not hard code the useid & pwd w/o having to create a user interface ?
> tks & rdgs

Prompting connection str to access SQL server

Hi ,
my connection string is as per follows but how can i made it such that i
need not hard code the useid & pwd w/o having to create a user interface ?
tks & rdgsCan you please send the connection string
--
best Regards,
Chandra
http://chanduas.blogspot.com/
---
"maxzsim" wrote:
> Hi ,
> my connection string is as per follows but how can i made it such that i
> need not hard code the useid & pwd w/o having to create a user interface ?
> tks & rdgs|||As far as I understand - you must use trusted connection option and depend
on account that your application work with.
Bojidar Alexandrov
"maxzsim" <maxzsim@.discussions.microsoft.com> wrote in message
news:DD415C15-32D4-43DC-B9AC-5C44D08DC738@.microsoft.com...
> Hi ,
> my connection string is as per follows but how can i made it such that i
> need not hard code the useid & pwd w/o having to create a user interface ?
> tks & rdgs|||That depends just on your application you code, there are serveral ways for
doing this:
Storing the password in a external storage (evtl. with encryption)
-registry
-xml file
-active directory
...
Using Windows Authentification:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adminsql/ad_security_47u6.asp
Using a DSN to connect with, (Has already a GUI ;-) )
But all that depends ont eh app you are coding the enviroment and so on..
HTH, Jens Suessmeyer.
--
http://www.sqlserver2005.de
--
"maxzsim" <maxzsim@.discussions.microsoft.com> schrieb im Newsbeitrag
news:DD415C15-32D4-43DC-B9AC-5C44D08DC738@.microsoft.com...
> Hi ,
> my connection string is as per follows but how can i made it such that i
> need not hard code the useid & pwd w/o having to create a user interface ?
> tks & rdgssql

prompted for username and password

hi,
I've a .net app written to view reports. The app is set up in iis
with the anonymous access checked and integrated windows
authentication checked for the default web site (my app - it's a
dedicated web server) and the same with the Reports and ReportServer
virtual directories within the Default Web Site.
I can get to my app's start page fine and browse the site I've
written, but when I try to view a report from the app I am prompted
for a username and password. Why is this and how can I get rid of
it'
I've added new roles for everyone and iusr_<machinename> but still I
can't get rid of these prompts.
Any ideas'
Gearóidlook at internet explorer configuration. Security / Intranet / and deselect
"Ask for..."
"Gearoid" wrote:
> hi,
> I've a .net app written to view reports. The app is set up in iis
> with the anonymous access checked and integrated windows
> authentication checked for the default web site (my app - it's a
> dedicated web server) and the same with the Reports and ReportServer
> virtual directories within the Default Web Site.
> I can get to my app's start page fine and browse the site I've
> written, but when I try to view a report from the app I am prompted
> for a username and password. Why is this and how can I get rid of
> it'
> I've added new roles for everyone and iusr_<machinename> but still I
> can't get rid of these prompts.
> Any ideas'
> Gearóid
>|||Thanks for the suggestion but that doesn't seem to be the problem. If
I run the report server from my own machine and try to access reports
from other machines accross the network there's no problem. But if I
deploy the reports to a web server (still on the same network) I get
prompted for the username / password.
Does this sound like a firewall issue with the web server? Or an IIS
issue? Or a Report Server Config issue?
I am truly stumpted here...
"LeCroix" <LeCroix@.discussions.microsoft.com> wrote in message news:<4B95B3D1-745F-4D8F-A127-5EEA073F7626@.microsoft.com>...
> look at internet explorer configuration. Security / Intranet / and deselect
> "Ask for..."
> "Gearoid" wrote:
> > hi,
> >
> > I've a .net app written to view reports. The app is set up in iis
> > with the anonymous access checked and integrated windows
> > authentication checked for the default web site (my app - it's a
> > dedicated web server) and the same with the Reports and ReportServer
> > virtual directories within the Default Web Site.
> >
> > I can get to my app's start page fine and browse the site I've
> > written, but when I try to view a report from the app I am prompted
> > for a username and password. Why is this and how can I get rid of
> > it'
> >
> > I've added new roles for everyone and iusr_<machinename> but still I
> > can't get rid of these prompts.
> >
> > Any ideas'
> >
> > Gearóid
> >

Prompt Parameter Query?

Hi there,
How to I convert Northwind Access Query look like this
SELECT Employees.EmployeeID, Employees.LastName, Employees.FirstName,
Employees.HireDate
FROM Employees
WHERE
(((Employees.HireDate) Between [Enter Begining date]
And
[Enter ending date]))
OR
(((([Employees].[HireDate]) Like [Enter Begining date]) Is Null))
OR
(((([Employees].[HireDate]) Like [Enter ending date]) Is Null));
Into SQL Server 2005 Stored Proc. I tried
create proc usp_hdate as
declare @.Hdate datetime
select FirstName, LastName, HireDate
From Employees
Where (HireDate = @.Hdate) or HireDate Is Not Null
but no results
All I want to create prompt parameter for HireDate
When you don't type parameter It will return all records
when you type the date it will return specific record
Thanks an advanced
Oded DrorCREATE PROC usp_hdate
AS
DECLARE @.Hdate DATETIME
SELECT FirstName, LastName, HireDate
FROM Employees
WHERE HireDate = COALESCE(@.Hdate,HireDate)
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
Oded Dror wrote:
> Hi there,
> How to I convert Northwind Access Query look like this
> SELECT Employees.EmployeeID, Employees.LastName, Employees.FirstName,
> Employees.HireDate
> FROM Employees
> WHERE
> (((Employees.HireDate) Between [Enter Begining date]
> And
> [Enter ending date]))
> OR
> (((([Employees].[HireDate]) Like [Enter Begining date]) Is Null))
> OR
> (((([Employees].[HireDate]) Like [Enter ending date]) Is Null));
>
> Into SQL Server 2005 Stored Proc. I tried
> create proc usp_hdate as
> declare @.Hdate datetime
> select FirstName, LastName, HireDate
> From Employees
> Where (HireDate = @.Hdate) or HireDate Is Not Null
> but no results
> All I want to create prompt parameter for HireDate
> When you don't type parameter It will return all records
> when you type the date it will return specific record
>
> Thanks an advanced
> Oded Dror
>
>
>
>|||Thanks for your help
This will return all value if the parameter is null
but what about when I'm submitting parameter
Basically I want to submit parameter and received one record or
don't submit record and received all records
Thanks,
Ed Dror
"MGFoster" <me@.privacy.com> wrote in message
news:iiVyf.3116$Hd4.2207@.newsread1.news.pas.earthlink.net...
> CREATE PROC usp_hdate
> AS
> DECLARE @.Hdate DATETIME
> SELECT FirstName, LastName, HireDate
> FROM Employees
> WHERE HireDate = COALESCE(@.Hdate,HireDate)
> --
> MGFoster:::mgf00 <at> earthlink <decimal-point> net
> Oakland, CA (USA)
> Oded Dror wrote:

Prompt for user input in criteria field of view

In Access, I use [Enter Date] in the Criteria field of the Query. I tried the same thing in SQL Server in the Criteria field of the View and it does not recognize this. Is there a comparable command in SQL to get user input into the Criteria field of a view?

Hi,

you either have to use a procedure with an input parameter or have to put a condition on the query with querying the view with:

Select * from SomeView Where SomeColumn = 'SomeValue'

But there is no GUI on SQL Server.

HTH, Jens Suessmeyer.

http://www.sqlserver2005.de

|||MSSQL as service prompts you nothing. You have to write client application to be prompted.|||

Hi Jens,

I was able to find out how to do what I needed using the @. sign (i.e. @.Date Required?). In the criteria field of the SQL view, this generates a 'Date Required?' prompt box when running the view.

Thanks anyway!

Ernie

sql

Tuesday, March 20, 2012

PROGRAMTICALLY ACCESS SQLDATASOURCE !

I am trying to acces an SQLDatasource in the code page, I have the following code but get the error as below, any one help please

The SQLDataSource returns 1 value named [ShippingRegion], I think that has somethjing to do with it ??!!

dsShippingRegion.Select(DataSourceSelectArguments.Empty)

Dim myReaderAs Data.IDataReader =CType(dsShippingRegion.Select(DataSourceSelectArguments.Empty), Data.IDataReader)
If myReader.ReadThen
If Convert.IsDBNull(myReader("ShippingRegion"))Then
Beep()
Else
Beep()
EndIf
EndIf

System.InvalidCastException was unhandled by user code
Message="Unable to cast object of type 'System.Data.DataView' to type 'System.Data.IDataReader'."
Source="App_Web_rd5quiy1"
StackTrace:
at admin_administer_shop_productaddnew.Page_Load(Object sender, EventArgs e) in E:\Web Development\WebSites\AJAX_sirs2hers\admin\administer_shop\productaddnew.aspx.vb:line 25
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

dsShippingRegion.Select(DataSourceSelectArguments.Empty)

In the SqlDataSource markup, set DataSourceMode="DataReader". If the DataSourceMode is DataSet (or is not set, since DataSet is the default), a DataView object is returned from Select, which is what you're seeing. If the DataSourceMode is DataReader, an IDataReader object is returned. Seehttp://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.sqldatasource.select.aspx for more details.

Hope that helps.

Aaron

|||

Aaron

this is the code for adding a product, what and where would i place to retrieve the returned value from the SPROC, insert is marked at the bottom with HERE IS THE INSERT

Thanks for the help, changed datasourcemode as above

Steve

ProtectedSub Button1_Click(ByVal senderAsObject,ByVal eAs System.EventArgs)Handles Button1.Click

If Trim(FCKeditor1.Value) =""Then

Dim AlertMSG ="Please enter product description"

ShrekGlobal.GlobalFunctions.CreateMessageAlert(Me, AlertMSG,"strKey1")

ExitSub

EndIf

Dim UploadImageAsBoolean =True

dsProduct.InsertParameters.Clear()

Dim ShopIDAsNew ControlParameter("ShopID","hfShopID","Value")

dsProduct.InsertParameters.Add(ShopID)

Dim CategoryIDAsNew ControlParameter("CategoryID","ddlCategories","SelectedValue")

dsProduct.InsertParameters.Add(CategoryID)

Dim ModelNumberAsNew ControlParameter("ModelNumber","txtModelNumber","Text")

dsProduct.InsertParameters.Add(ModelNumber)

Dim ModelNameAsNew ControlParameter("ModelName","txtModelName","Text")

dsProduct.InsertParameters.Add(ModelName)

Dim UnitCostAsNew ControlParameter("UnitCost","txtUnitCost","Text")

dsProduct.InsertParameters.Add(UnitCost)

Dim StockAsNew ControlParameter("Stock","txtStock","Text")

dsProduct.InsertParameters.Add(Stock)

Dim ProductDescriptionAsNew ControlParameter("ProductDescription","FCKeditor1","Value")

dsProduct.InsertParameters.Add(ProductDescription)

Dim ImageFilenameAsString

If ddlMainImage.SelectedIndex = 0Then

ImageFilename =""

Else

ImageFilename =String.Format("{0}.jpg", ddlMainImage.SelectedValue)

EndIf

dsProduct.InsertParameters.Add("ProductImage", ImageFilename)Dim ShippingIDUK1AsNew ControlParameter("ShippingID1","ddlUKShipping1","SelectedValue")

dsProduct.InsertParameters.Add(ShippingIDUK1)

Dim ShippingAmountUK1AsNew ControlParameter("ShippingAmount1","txtUKShipping1","Text")

dsProduct.InsertParameters.Add(ShippingAmountUK1)

Dim ShippingIDUK2AsNew ControlParameter("ShippingID2","ddlUKShipping2","SelectedValue")

dsProduct.InsertParameters.Add(ShippingIDUK2)

Dim ShippingAmountUK2AsNew ControlParameter("ShippingAmount2","txtUKShipping2","Text")

dsProduct.InsertParameters.Add(ShippingAmountUK2)

Dim ShippingIDUK3AsNew ControlParameter("ShippingID3","ddlUKShipping3","SelectedValue")

dsProduct.InsertParameters.Add(ShippingIDUK3)

Dim ShippingAmountUK3AsNew ControlParameter("ShippingAmount3","txtUKShipping3","Text")

dsProduct.InsertParameters.Add(ShippingAmountUK3)

Dim ShippingIDUK4AsNew ControlParameter("ShippingID4","ddlUKShipping4","SelectedValue")

dsProduct.InsertParameters.Add(ShippingIDUK4)

Dim ShippingAmountUK4AsNew ControlParameter("ShippingAmount4","txtUKShipping4","Text")

dsProduct.InsertParameters.Add(ShippingAmountUK4)

Dim ShippingIDUK5AsNew ControlParameter("ShippingID5","ddlUKShipping5","SelectedValue")

dsProduct.InsertParameters.Add(ShippingIDUK5)

Dim ShippingAmountUK5AsNew ControlParameter("ShippingAmount5","txtUKShipping5","Text")

dsProduct.InsertParameters.Add(ShippingAmountUK5)

Dim ShippingIDInt1AsNew ControlParameter("ShippingID6","ddlIntShipping1","SelectedValue")

dsProduct.InsertParameters.Add(ShippingIDInt1)

Dim ShippingAmountInt1AsNew ControlParameter("ShippingAmount6","txtIntShipping1","Text")

dsProduct.InsertParameters.Add(ShippingAmountInt1)

Dim ShippingIDInt2AsNew ControlParameter("ShippingID7","ddlIntShipping2","SelectedValue")

dsProduct.InsertParameters.Add(ShippingIDInt2)

Dim ShippingAmountInt2AsNew ControlParameter("ShippingAmount7","txtIntShipping2","Text")

dsProduct.InsertParameters.Add(ShippingAmountInt2)

Dim ShippingIDInt3AsNew ControlParameter("ShippingID8","ddlIntShipping3","SelectedValue")

dsProduct.InsertParameters.Add(ShippingIDInt3)

Dim ShippingAmountInt3AsNew ControlParameter("ShippingAmount8","txtIntShipping3","Text")

dsProduct.InsertParameters.Add(ShippingAmountInt3)

Dim ShippingIDInt4AsNew ControlParameter("ShippingID9","ddlIntShipping4","SelectedValue")

dsProduct.InsertParameters.Add(ShippingIDInt4)

Dim ShippingAmountInt4AsNew ControlParameter("ShippingAmount9","txtIntShipping4","Text")

dsProduct.InsertParameters.Add(ShippingAmountInt4)

Dim ShippingIDInt5AsNew ControlParameter("ShippingID10","ddlIntShipping5","SelectedValue")

dsProduct.InsertParameters.Add(ShippingIDInt5)

Dim ShippingAmountInt5AsNew ControlParameter("ShippingAmount10","txtIntShipping5","Text")

dsProduct.InsertParameters.Add(ShippingAmountInt5)

'Dim ProductImage As New ControlParameter("ProductImage", "siProductImage", "NewFileName")

'dsProduct.InsertParameters.Add(ProductImage)

Try

dsProduct.Insert() HERE IS THE INSERT

Dim xAsInteger

For x = 1To 8

'Dim SaveDirectory As String = String.Format("{0}\", Server.MapPath(TemporarySaveDirectory), x)

MsgBox(ddlCategories.SelectedValue)

Dim ProductIDAsInteger = 1

Dim SaveDirectoryAsString =String.Format("~\shopping_mall\images\shops\{0}\{1}\{2}\", Session("ShopID"), ddlCategories.SelectedValue, ProductID)

If ShrekGlobal.GlobalFunctions.FileMove(String.Format("{0}.jpg", x), Server.MapPath(TemporarySaveDirectory), Server.MapPath(SaveDirectory))Then

Beep()

Else

Beep()

EndIf

Next

'siProductImage.TemporarySaveDirectory = String.Format("~\shopping_mall\images\shops\{0}\{1}", hfShopID.Value, ddlCategories.SelectedValue)

'siProductImage.Upload()

ClearPage()

Catch exAs Exception

'UploadImage = False

DeleteImage(0)

MsgBox(String.Format("{0} ~ {1}","Error", ex.Message.ToString()))

'_lblInfo1.Text = sb.ToString

' Consider customizing the message for the EmailNotSentPanel in the ShowAds page.

'Beep()

'_lblInfo1.Text = Now + " :: " + sb.ToString

EndTry

'If UploadImage Then

'Dim TemporarySaveDirectory As String

'aveDirectory =

'End If

EndSub

|||

Try this article:http://aspnet.4guysfromrolla.com/articles/050207-1.aspx

Hope that helps.

Aaron

Monday, March 12, 2012

Programming SSIS - Exception 0xC0204006

Hello. I am attempting to use SSIS to import a table from MS Access in to SQL Server. However, when i set the destination component properties I get the following error:

Exception from HRESULT: 0xC0204006

The table exists within the destination database and if I comment the line out, it is able to acquire the connection.Anyone have any ideas?

Thanks

ConnectionManager connMgr;
ConnectionManager connMgr1;

//Create the package
Microsoft.SqlServer.Dts.Runtime.Package package = new Microsoft.SqlServer.Dts.Runtime.Package();

//Create to connections to the package
Connections packageConns = package.Connections;

connMgr1 = package.Connections.Add("OLEDB");
connMgr1.ConnectionString = accessModelConnectString;
connMgr1.Name = "OLEDB ConnectionManager";

connMgr = package.Connections.Add("OLEDB");
connMgr.ConnectionString = sqlConnectionString;
connMgr.Name = "OLEDB ConnectionManager1";

//Add a dataflow task to the package.
MainPipe dataFlowTask = ((Microsoft.SqlServer.Dts.Runtime.TaskHost)package.Executables.Add("DTS.Pipeline")).InnerObject as MainPipe;

IDTSComponentMetaData90 sourceComponent = dataFlowTask.ComponentMetaDataCollection.New();
sourceComponent.ComponentClassID = "DTSAdapter.OleDbSource.1";
sourceComponent.Name = "yyy";

// Get the design time instance of the component.
CManagedComponentWrapper instance = sourceComponent.Instantiate();

// Initialize the component
instance.ProvideComponentProperties();

// Specify the connection manager.
if (sourceComponent.RuntimeConnectionCollection.Count > 0)
{
sourceComponent.RuntimeConnectionCollection[0].ConnectionManager = DtsConvert.ToConnectionManager90(package.Connections[0]);
sourceComponent.RuntimeConnectionCollection[0].ConnectionManagerID = package.Connections[0].ID;
}

// Set the custom properties.
instance.SetComponentProperty("AccessMode", 2);
instance.SetComponentProperty("SqlCommand", "SELECT Test FROM Test");

// Reinitialize the metadata.
instance.AcquireConnections(null);
instance.ReinitializeMetaData();
instance.ReleaseConnections();

IDTSComponentMetaData90 destinationComponent = dataFlowTask.ComponentMetaDataCollection.New();
destinationComponent.ComponentClassID = "DTSAdapter.OleDBDestination.1";
destinationComponent.Name = "xxx";

// Get the design time instance of the component.
CManagedComponentWrapper instance1 = destinationComponent.Instantiate();

// Initialize the component
instance1.ProvideComponentProperties();

// Specify the connection manager.
if (destinationComponent.RuntimeConnectionCollection.Count > 0)
{
destinationComponent.RuntimeConnectionCollection[0].ConnectionManager = DtsConvert.ToConnectionManager90(package.Connections[1]);
destinationComponent.RuntimeConnectionCollection[0].ConnectionManagerID = package.Connections[1].ID;
}

instance1.SetComponentProperty("AccessMode", 3);
instance1.SetComponentProperty("OpenRowSet", "[PedestrianFlow].[dbo].[OLE DB Destination]");


// Reinitialize the metadata.
instance1.AcquireConnections(null);
instance1.ReinitializeMetaData();
instance1.ReleaseConnections();

// Create the path.
IDTSPath90 path = dataFlowTask.PathCollection.New();
path.AttachPathAndPropagateNotifications(sourceComponent.OutputCollection[0],destinationComponent.InputCollection[0]);

IDTSInput90 input = destinationComponent.InputCollection[0];
IDTSVirtualInput90 vInput = input.GetVirtualInput();

// Iterate through the virtual column collection.
foreach (IDTSVirtualInputColumn90 vColumn in vInput.VirtualInputColumnCollection)
{
string y = vColumn.Name;
// Call the SetUsageType method of the design time instance of the component.
instance1.SetUsageType(input.ID, vInput, vColumn.LineageID, DTSUsageType.UT_READONLY);
}

Microsoft.SqlServer.Dts.Runtime.DTSExecResult result = package.Execute();

foreach (DtsError pkgerror in package.Errors)
{
string err = pkgerror.Description;
Console.WriteLine(err);
}

Can anybody help? I am getting nowhere fast.

Thanks.|||

This explains it quite well I think, but feel free to update-

0xC0204006
(http://wiki.sqlis.com/default.aspx/SQLISWiki/0xC0204006.html)

Check the property you are using, it does not exist.

|||... case sensitive name is what I meant to add.|||

Thankyou, you are a life saver. I can't believe I missed that, I have been staring at that code for hours.

Thanks again.|||

cjturner wrote:

Thankyou, you are a life saver. I can't believe I missed that, I have been staring at that code for hours.

Thanks again.

Please be sure to mark the appropriate post as the answer to your question.

Programming + MSDE 2000

Hi.
I want to be able to programmatically access MSDE
databases. I would rather not use Visual Basic. My
preference would be to either access MSDE databases using
ODBC, or to use a DLL, so that I am more flexible in my
choice of programming tools. If all else fails, then I
would have to use some API (I do not use .NET, the latest
version of Visual C++ I have is 6.0, and I would rather not
have to upgrade). What are my options? Where do I get the
API, if one is necessary?
TIA,
Joseph
From classic VB, ADO is probably your best choice. ADO is a COM object, and
it comes with MDAC (I believe), which you already have on your machine
assuming you have a decently recent OS (W2K or higher). There are some ADO
newsgroups I believe, btw.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
"Joseph" <msde2000@.techscribe.com> wrote in message
news:18a301c4110f$ddb27be0$7d02280a@.phx.gbl...
> Hi.
> I want to be able to programmatically access MSDE
> databases. I would rather not use Visual Basic. My
> preference would be to either access MSDE databases using
> ODBC, or to use a DLL, so that I am more flexible in my
> choice of programming tools. If all else fails, then I
> would have to use some API (I do not use .NET, the latest
> version of Visual C++ I have is 6.0, and I would rather not
> have to upgrade). What are my options? Where do I get the
> API, if one is necessary?
> TIA,
> Joseph
|||"Joseph" <msde2000@.techscribe.com> wrote in message
news:18a301c4110f$ddb27be0$7d02280a@.phx.gbl...
> Hi.
> I want to be able to programmatically access MSDE
> databases. I would rather not use Visual Basic. My
> preference would be to either access MSDE databases using
> ODBC, or to use a DLL, so that I am more flexible in my
> choice of programming tools. If all else fails, then I
> would have to use some API (I do not use .NET, the latest
> version of Visual C++ I have is 6.0, and I would rather not
> have to upgrade). What are my options? Where do I get the
> API, if one is necessary?
> TIA,
> Joseph
As you mention C++ and VB 6, I'll assume you're doing Windows apps?
There are MFC classes that support database access, since you say you'd
prefer not to use VB.
CDatabase, CRecordset, etc are what you want.
Peter [MVP Academic]
|||MSDE 2000 supports the same API set as the database engine in the other
versions of SQL Server 2000:
ADO.NET using the SQLClient namespace.
ADO and OLE DB using the SQLOLEDB provider
ODBC using the SQL Server ODBC Driver.
For more information, see this topic in the latest update to the SQL Server
2000 Books Online:
http://msdn.microsoft.com/library/?u...asp?frame=true
You can also download the latest version of the Books Online from this
location:
http://www.microsoft.com/sql/techinf...2000/books.asp
Alan Brewer [MSFT]
Lead Programming Writer
SQL Server Documentation Team
This posting is provided "AS IS" with no warranties, and confers no rights

Wednesday, March 7, 2012

Programmatically Access The ExecuteProcessTask

Hi all,

I am trying to programmatically create an Execute Process Task in an SSIS package.

So far, I have the following:

Private package As Package
Dim th As TaskHost = TryCast(package.Executables.Add("STOCK:ExecuteProcessTask"), TaskHost)
th.Name = "Execute Process Task"
th.Description = "Execute Process Task"

That will get me the ExecuteProcessTask in my package that I want. But now, I would like to set the properties of it (i.e., the executable and arguments)

Basically, my IDE does not have any idea what an "ExecuteProcessTask" is. After lots of research, I cannot find out which assembly I need to reference in order to gain access to this object. In addition, whenever I try to Import the assembly that I think it is (i.e. Microsoft.SqlServer.ExecProcTask, or Microsoft.SqlServer.Dts.Tasks.ExecuteProcess), none of them work. I can see in my Assembly Cache that the .dll is registered correctly ...

What is going on?
What do you mean "none of them work"? When you set a reference to the Microsoft.SqlServer.ExecProcTask.dll then the code below should work.

Code Snippet

Dim execProc As Microsoft.SqlServer.Dts.Tasks.ExecuteProcess.ExecuteProcess = CType(th.InnerObject, Microsoft.SqlServer.Dts.Tasks.ExecuteProcess.ExecuteProcess)
execProc.Executable = "executable.exe"
execProc.Arguments = "/arguments"

|||Really, my problem is that I can't access the assembly that I need.

Basically, I need access to the Microsoft.SqlServer.Dts.Tasks.ExecProcTask assembly-

But, when I try to add a reference to it, I do not see it. In addition, with the interface in SSIS, I cannot "browse" for the assembly.

The only assembly that shows up in Intellisense is Microsoft.SqlServer.Dts.Tasks.ScriptTask

I am editing a script task- so what good is a script task if I can't access the assemblies I need?

What can I do?

|||Ah, you need to copy it from C:\Program Files\Microsoft SQL Server\90\DTS\Tasks to C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727. Then it will show up in your References.
|||Graahhhhh!! I just came up with that idea, tried it out and it worked- graahh-- wasted so much time and was so frustrated by that yesterday because of something so simple- I hate that!

Saturday, February 25, 2012

Programmatic access to the code SQLCMD uses to parse sql into batches

Hi,

I am thinking of writing a C# Windows app to iterate a set of sql scripts and submit them to SQL Server. Many scripts have "go" as a batch delimiter. I could probably figure out a regular expression to parse for that delimiter, but it seems tricky (need to exclude 'go', -- go, /* go */, etc). Obviously SQLCMD and Management Studio have a way to do this. I was wondering if that's exposed in an API anywhere. I looked into the SMO object model, but I couldn't find it.

Thanks much,

Mike

Hi,

thats no mafic, just use the SET PARSEONLY statement before your statements to check.

HTH, Jens Suessmeyer.


http://www.sqlserver2005.de

|||

As far as I can tell "set parseonly on" just checks the syntax. I want to get back a collection of strings to submit, each one a proper batch. Eg:

select 'Inside quotes, go or " go " or '' go '' is not a delimiter ' as go -- not go here

select 'Second go '

go

select 'Another batch here /* go */ go '

go

In query analyzer or management studio this appropriately returns 3 result sets, presumably executed as 2 batches. I would like to identify the first 2 lines as one batch, and the second select as another batch.

Mike

Programmatic Access to SQL database


New at this and would like to get the code in VB or . Net which would
allow connection, reading and writing to a SQL database previously
created.
*** Sent via Developersdex http://www.examnotes.net ***
Don't just participate in USENET...get rewarded for it!Try taking a look here, there are many examples to choose from...
http://gotdotnet.com/Community/User...?query=database
"John Brown" wrote:

>
> New at this and would like to get the code in VB or . Net which would
> allow connection, reading and writing to a SQL database previously
> created.
> *** Sent via Developersdex http://www.examnotes.net ***
> Don't just participate in USENET...get rewarded for it!
>

Programmatic access to Enabled Protocols in SQL2005?

My C++ program is able to read the "Enabled Protocols" for SQL2005 by
reading the registry at:
HKLM\Software\Microsoft\Microsoft SQL Server\<instance
name>\MSSQLServer\SuperSocketLib\<protocol alias> and then reading the
"Enabled" value to see if it is enabled or not.
This works fine for named instances, but I can't find the registry values
that tell me which Enabled Protocols are defined for the default instance in
SQL2005.
Can anyone assist?
Many thanks!Hi,
Thanks for your post!
From your description, I understand that:
Your application need to search for the SQL Server 2005 enabled protocols
information in registry.
You managed to get the "Enable" value if the SQL Server was installed as a
named instance;
however the "Enable" value was not found at that location if the SQL Server
was installed as a default instance.
If I have misunderstood, please let me know.
From my research, I found the "Enable" value was under the directory
"HKLM\Software\Microsoft\Microsoft SQL
Server\MSSQL.1\MSSQLServer\SuperSocketNetLib\<protocol alias>",
which was different from yours. My SQL Server 2005 was installed as a named
instance as well.
The directory as you mentioned is also existed in my registry, however I
couldn't find the "Enable" value under that.
In fact, if your SQL Server 2005 was installed as a default instance, you
may found the default value "MSSQLServer" under
HKLM\Software\Microsoft\Microsoft SQL Server\MSSQL.x\MSSQLServer\
Both default instance and named instance have the related registry key
MSSQL.x. The registry directory "MSSQL.1" references the first instance of
your SQL Server 2005, so I recommend you check that registry directory
firstly.
Also, you may try to search for the key value "SuperSocketNetLib" under the
registry directory "HKLM\Software\Microsoft\".
If you have any other concerns, please feel free to let me know. It's my
pleasure to be of assistance.
+++++++++++++++++++++++++++
Charles Wang
Microsoft Online Partner Support
+++++++++++++++++++++++++++
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
========================================
=============
Business-Critical Phone Support (BCPS) provides you with technical phone
support at no charge during critical LAN outages or "business down"
situations. This benefit is available 24 hours a day, 7 days a w to all
Microsoft technology partners in the United States and Canada.
This and other support options are available here:
BCPS:
https://partner.microsoft.com/US/te...erview/40010469
Others:
https://partner.microsoft.com/US/te...upportoverview/
If you are outside the United States, please visit our International
Support page:
http://support.microsoft.com/defaul...rnational.aspx.
========================================
=============
This posting is provided "AS IS" with no warranties, and confers no rights.|||Hi,
Just checking in to see if the suggestions were helpful. Please let us know
if you would like further assistance.
Have a great day!
+++++++++++++++++++++++++++
Charles Wang
Microsoft Online Partner Support
+++++++++++++++++++++++++++
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
========================================
=============
Business-Critical Phone Support (BCPS) provides you with technical phone
support at no charge during critical LAN outages or "business down"
situations. This benefit is available 24 hours a day, 7 days a w to all
Microsoft technology partners in the United States and Canada.
This and other support options are available here:
BCPS:
https://partner.microsoft.com/US/te...erview/40010469
Others:
https://partner.microsoft.com/US/te...upportoverview/
If you are outside the United States, please visit our International
Support page:
http://support.microsoft.com/defaul...rnational.aspx.
========================================
=============
This posting is provided "AS IS" with no warranties, and confers no rights.

programm using ado(sql server 2005) do not run in Windows Vista

Hi!

My C++ programm that use ADO to access SQL Server 2005 Express do not work in Windows Vista. Programm code works in Windows XP, but fails in Vista.

_bstr_t strCnn = L"Provider = 'SQLNCLI'; Data Source='\SERVERSQL';Uid=sa;Pwd=devel; ";
ADODB::_CommandPtr _command;
TESTHR(_command.CreateInstance(__uuidof(ADODB::Command)));
_command->PutActiveConnection(strCnn);

Error:

Unhandled exception in test.exe (secur32.dll) 0xC0000005. Access Violation.

Help Me please.

cmd-connection

C:\>OSQL.exe /S USER123-VISTA\\SERVERSQL /U sa /P devel /i c:\\test\1.sql
error

[SQL Native Client]Client unable to establish connection due to prelogin
failure

I'm not sure why you double the backslashes in the command line, and don't double in the connection string.|||

ok , thanks

in command line run

|||

Help

not work in Vista!

My C++ programm that use ADO to access SQL Server 2005 Express do not work in Windows Vista. Programm code works in Windows XP, but fails in Vista.

_bstr_t strCnn = L"Provider = 'SQLNCLI'; Data Source='\SERVERSQL';Uid=sa;Pwd=devel; ";
ADODB::_CommandPtr _command;
TESTHR(_command.CreateInstance(__uuidof(ADODB::Command)));
_command->PutActiveConnection(strCnn);


Error:

Unhandled exception in test.exe (secur32.dll) 0xC0000005. Access Violation.

Help Me please.

The similar problem

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1517814&SiteID=1

I has not understood the decision