Friday, March 23, 2012
OpenDataSource with Microsoft.Jet.OLEDB.4 Excel from stored proced
select * from FROM OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
'Data Source="\\MachineName\shared\account.xls";...Excel 8.0...
This stored procedure was called from a VB application. It's odd that
ONLY when ADO connection user need SA database role
AND \\MachineName\shared\account.xls was physical located in the same
machine of DATABASE
the stored procedure would work.
Otherwise it returned error like:
OLE DB error trace [OLE/DB Provider 'Microsoft.Jet.OLEDB.4.0'
IDBInitialize::Initialize returned 0x80004005: The provider did not give any
information about the error.]. 0 7300 -2147217900 Microsoft OLE DB Provider
for SQL Server 01000OLE DB provider 'Microsoft.Jet.OLEDB.4.0' reported an
error. The provider did not give any information about the error. 0 7399
-2147217900 Microsoft OLE DB Provider for SQL Server 42000
Database is SQL Server 2000 SP4. Registry DisallowAdhocAccess is 0.
Any suggestion?Because the security reson, I don't want ADO connection user has the SA role,
and Excel file can located in any shared folder in the LAN.
"david" wrote:
> I have a stored procedure which has the following line:
> select * from FROM OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
> 'Data Source="\\MachineName\shared\account.xls";...Excel 8.0...
> This stored procedure was called from a VB application. It's odd that
> ONLY when ADO connection user need SA database role
> AND \\MachineName\shared\account.xls was physical located in the same
> machine of DATABASE
> the stored procedure would work.
> Otherwise it returned error like:
> OLE DB error trace [OLE/DB Provider 'Microsoft.Jet.OLEDB.4.0'
> IDBInitialize::Initialize returned 0x80004005: The provider did not give any
> information about the error.]. 0 7300 -2147217900 Microsoft OLE DB Provider
> for SQL Server 01000OLE DB provider 'Microsoft.Jet.OLEDB.4.0' reported an
> error. The provider did not give any information about the error. 0 7399
> -2147217900 Microsoft OLE DB Provider for SQL Server 42000
> Database is SQL Server 2000 SP4. Registry DisallowAdhocAccess is 0.
> Any suggestion?
>
Tuesday, March 20, 2012
Open Report Builder and Link to Report Directly?
Hi,
I've created a simple webpart that lists all the reports that a user has created using the Report Builder and next to each line item is an "Edit" link. What I would like to do is open up the Report Builder application and pass a parameter of the report path or something like that so that report builder opens up the report automatically.
Is this possible?
Thanks
Tristian
http://blogs.msdn.com/bobmeyers/archive/2006/01/24/517083.aspx|||THanks, this worked great!Monday, March 12, 2012
Open and close SQL server via command prompt
I'am working with a mirroring batch file, It performs a mirroring of a works
tation (database files) in a lab and a secured backuped server
Someone can help me
thanksI assume you mean start and stop the SQL Server service?
NET START MSSQLSERVER
NET STOP MSSQLSERVER
Don't forget to handle the SQL Server agent server, which is dependent on th
e SQL Server service. Also, if it
is a named instance, you need to adjust the service name (see the "Services"
windows applet).
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
"Capone Raphael" <capone.raphael@.skynet.be> wrote in message
news:5409F787-DF3E-4B4F-A6FD-950B5AFA7268@.microsoft.com...
> I need command line to open and close SQL server
> I'am working with a mirroring batch file, It performs a mirroring of a workstation
(database files) in a lab
and a secured backuped server
> Someone can help me
> thanks|||I am not sure what you mean by "open and close." =20
If you need to connect via the command line, try osql.exe
--=20
Keith
"Capone Raphael" <capone.raphael@.skynet.be> wrote in message =
news:5409F787-DF3E-4B4F-A6FD-950B5AFA7268@.microsoft.com...
> I need command line to open and close SQL server=20
> I'am working with a mirroring batch file, It performs a mirroring of a =
workstation (database files) in a lab and a secured backuped server
>=20
> Someone can help me=20
>=20
> thanks
Friday, March 9, 2012
Open / Read / Split / Insert / Repeat
What I want to do before it goes to the next line is insert that strData in to a SQL DB.
This is my InsertCommand for my SqlDataSource1:
InsertCommand="INSERT INTO [Numbers] ([WTN], [DSL_Qualified], [DSL_Qualified_Date], [Equip_1MM], [Line_Trouble], [Sync_Rate], [Res_Bus], [Host_Remote]) VALUES (@.WTN, @.DSL_Qualified, @.DSL_Qualified_Date, @.Equip_1MM, @.Line_Trouble, @.Sync_Rate, @.Res_Bus, @.Host_Remote)"
Plus the <InsertParameters>:
<InsertParameters>
<asp:Parameter Name="WTN" Type="Int32" />
<asp:Parameter Name="DSL_Qualified" Type="String" />
<asp:Parameter Name="DSL_Qualified_Date" Type="DateTime" />
<asp:Parameter Name="Equip_1MM" Type="String" />
<asp:Parameter Name="Line_Trouble" Type="String" />
<asp:Parameter Name="Sync_Rate" Type="String" />
<asp:Parameter Name="Res_Bus" Type="String" />
<asp:Parameter Name="Host_Remote" Type="String" />
</InsertParameters
So I'm not sure exactly what to do after this:
while (file.Peek() > -1)
{
string strCSVData = file.ReadLine();
string [] strData = strCSVData.Split(',');
// somehow get strData in to the SqlDataSource1.Insert method??
}
Any help would be appreciated.
Thanks.
DataSource controls are meant to be databound to other controls. You can programmatically control them, but they can be a bit touchy if you do.
This is what you want:
(Written in vb.net, sorry)
Dim conn as new sqlconnection("{Your connect string here}") ' or pull from web.config
dim cmd as new sqlcommand("INSERT INTO [Numbers] ([WTN], [DSL_Qualified], [DSL_Qualified_Date], [Equip_1MM], [Line_Trouble], [Sync_Rate], [Res_Bus], [Host_Remote]) VALUES (@.WTN, @.DSL_Qualified, @.DSL_Qualified_Date, @.Equip_1MM, @.Line_Trouble, @.Sync_Rate, @.Res_Bus, @.Host_Remote)",conn)
cmd.parameters.add("@.WTN",int)
cmd.parameters.add("@.DSL_Qualified",varchar)
cmd.parameters.add("@.DSL_Qualified_Date",datetime)
{add rest of parameters here}
conn.open;
while (file.Peek() > -1)
{
string strCSVData = file.ReadLine();
string [] strData = strCSVData.Split(',');
// somehow get strData in to the SqlDataSource1.Insert method??
cmd.parameters("@.WTN").value=strData[0];
cmd.parameters("@.DSL_Qualified").value=strData[1];
{Set rest of parameters here}
cmd.executenonquery;
}
conn.close;
Your other choices if you really want to continue with the sqldatasource control, is to set the parameters using the default values, then call the .insert method of the datasource control. If that doesn't work, then you can make strData class scoped variable (Private member for C#?), call the .insert method, and catch the datasource_Inserting event, and set the sqlcommand parameters there via e.command.parameters.
Monday, February 20, 2012
online index rebuild and update statistics
Hi ..
Please advice whether i have to do update statistics along with Index rebuild (online /off line)
Thanks in advance
This depends on the traffic on your DB. IF its an OLTP/heavily used DB you might keep this for off peak use. Your Index scripts could be scripted to either update or do not update stats. You dont *have to* update stats. Its optional. But generally its good to keep updated stats. Again, depending on your Db size and usage, you can turn Auto Statistics ON or OFF.|||Manual statistics update is preferable in off-peak hours
|||To reword his question a little bit, if you perform Alter Index .... Rebuild, do you need to also perform an Update Statistics with full scan afterwards? The Alter Index ... Rebuild updates stats based on sampling rates. Is there any real advantage to updating the stats with a full scan afterwards?online index rebuild and update statistics
Hi ..
Please advice whether i have to do update statistics along with Index rebuild (online /off line)
Thanks in advance
This depends on the traffic on your DB. IF its an OLTP/heavily used DB you might keep this for off peak use. Your Index scripts could be scripted to either update or do not update stats. You dont *have to* update stats. Its optional. But generally its good to keep updated stats. Again, depending on your Db size and usage, you can turn Auto Statistics ON or OFF.|||Manual statistics update is preferable in off-peak hours
|||To reword his question a little bit, if you perform Alter Index .... Rebuild, do you need to also perform an Update Statistics with full scan afterwards? The Alter Index ... Rebuild updates stats based on sampling rates. Is there any real advantage to updating the stats with a full scan afterwards?online book "script error-object doesn't support this property or
Error" comes out:
Line 1
char 1
Error: Object doesn't support this property or method
code 0
URL: ..
It works fine before. I don't know why this error show.vollen,
Can you reapply the latest Internet Explorer service pack? This should
fix it.
--
Mark Allison, SQL Server MVP
http://www.markallison.co.uk
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602m.html
vollen wrote:
> When I click some link of book online, then an "Internet explorer Script
> Error" comes out:
> Line 1
> char 1
> Error: Object doesn't support this property or method
> code 0
> URL: ..
>
> It works fine before. I don't know why this error show.