Showing posts with label visual. Show all posts
Showing posts with label visual. Show all posts

Sunday, March 25, 2012

ActiveX info

I'm getting a little confused about what is supported in MS-SQL ActiveX and
what is Visual Basic and what is VBScript. Can someone please point me to a
website, recommend a book or if I've missed it where in the MS-SQL help that
deals with the ActiveX supported in SQL. I'm not looking to do web pages
ASP, ect. I'm looking to use the ActiveX as add on funtionality to support
the Stored Procs I write.

Thanks,

-pPippen (123@.hotmail.com) writes:
> I'm getting a little confused about what is supported in MS-SQL ActiveX
> and what is Visual Basic and what is VBScript. Can someone please point
> me to a website, recommend a book or if I've missed it where in the
> MS-SQL help that deals with the ActiveX supported in SQL. I'm not
> looking to do web pages ASP, ect. I'm looking to use the ActiveX as add
> on funtionality to support the Stored Procs I write.

Personally I get confused only I see the term ActiveX. I think it is the
same as OLE, but I might be completely wrong.

Anyway, to call OLE objects from SQL Server you can use the sp_OAxxxx
routines, documented in Books Online.

Beware that if you call OLE objects that reside on the same machine as
SQL Server, they execute in-process, which means that an access violation
or similar execution error can cause the whole SQL Server to crash. While
this is useful at times, it something to use with caution.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||"Erland Sommarskog" <esquel@.sommarskog.se> wrote in message
news:Xns959C1FC09AB7Yazorman@.127.0.0.1...
> Pippen (123@.hotmail.com) writes:
>> I'm getting a little confused about what is supported in MS-SQL ActiveX
>> and what is Visual Basic and what is VBScript. Can someone please point
>> me to a website, recommend a book or if I've missed it where in the
>> MS-SQL help that deals with the ActiveX supported in SQL. I'm not
>> looking to do web pages ASP, ect. I'm looking to use the ActiveX as add
>> on funtionality to support the Stored Procs I write.
> Personally I get confused only I see the term ActiveX. I think it is the
> same as OLE, but I might be completely wrong.
> Anyway, to call OLE objects from SQL Server you can use the sp_OAxxxx
> routines, documented in Books Online.
> Beware that if you call OLE objects that reside on the same machine as
> SQL Server, they execute in-process, which means that an access violation
> or similar execution error can cause the whole SQL Server to crash. While
> this is useful at times, it something to use with caution.
>
> --
> Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
> Books Online for SQL Server SP3 at
> http://www.microsoft.com/sql/techin.../2000/books.asp

After re-reading my post I did not make myself very clear... Please let me
try again. I'm looking to find resources to write ActiveX code to support my
stored procs ect... I'm confused on what the built in ActiveX compiler uses
out of the VBScript language. All of the VBScript books I pick up look like
they are written for web designers. I'm looking for a book or resource for
writing code for the ActiveX compiler in MS-SQL.

Sorry for the confusion,

-p|||Like a lot of Microsoft technology terms, ActiveX is a bit nebulous. Here's
a link to google definitions:
http://www.google.com/search?source...fine%3A+activex

The main concept is that ActiveX is a technology/API rather than a language.
One can write a script in a language like VBScript and then execute it using
SQL Server tools like a DTS ActiveX Script task, a SQL Server Agent ActiveX
Script job step or using the sp_OA* procs that Erland mentioned. The script
can also be run independently of SQL Server using Windows Scripting Host.

What functionality do you need to implement?

--
Hope this helps.

Dan Guzman
SQL Server MVP

"Pippen" <123@.hotmail.com> wrote in message
news:ajUjd.483788$mD.296273@.attbi_s02...
> "Erland Sommarskog" <esquel@.sommarskog.se> wrote in message
> news:Xns959C1FC09AB7Yazorman@.127.0.0.1...
>> Pippen (123@.hotmail.com) writes:
>>> I'm getting a little confused about what is supported in MS-SQL ActiveX
>>> and what is Visual Basic and what is VBScript. Can someone please point
>>> me to a website, recommend a book or if I've missed it where in the
>>> MS-SQL help that deals with the ActiveX supported in SQL. I'm not
>>> looking to do web pages ASP, ect. I'm looking to use the ActiveX as add
>>> on funtionality to support the Stored Procs I write.
>>
>> Personally I get confused only I see the term ActiveX. I think it is the
>> same as OLE, but I might be completely wrong.
>>
>> Anyway, to call OLE objects from SQL Server you can use the sp_OAxxxx
>> routines, documented in Books Online.
>>
>> Beware that if you call OLE objects that reside on the same machine as
>> SQL Server, they execute in-process, which means that an access violation
>> or similar execution error can cause the whole SQL Server to crash. While
>> this is useful at times, it something to use with caution.
>>
>>
>> --
>> Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
>>
>> Books Online for SQL Server SP3 at
>> http://www.microsoft.com/sql/techin.../2000/books.asp
> After re-reading my post I did not make myself very clear... Please let me
> try again. I'm looking to find resources to write ActiveX code to support
> my stored procs ect... I'm confused on what the built in ActiveX compiler
> uses out of the VBScript language. All of the VBScript books I pick up
> look like they are written for web designers. I'm looking for a book or
> resource for writing code for the ActiveX compiler in MS-SQL.
> Sorry for the confusion,
> -p|||Pippen (123@.hotmail.com) writes:
> After re-reading my post I did not make myself very clear... Please let
> me try again. I'm looking to find resources to write ActiveX code to
> support my stored procs ect... I'm confused on what the built in ActiveX
> compiler uses out of the VBScript language. All of the VBScript books I
> pick up look like they are written for web designers. I'm looking for a
> book or resource for writing code for the ActiveX compiler in MS-SQL.

Since, as Dan said, no one really knows what ActiveX (save, possibly,
for the marketers that invented the term), it may be easier if you told
us what your business problem is.

Now it sounds a bit like you are asking to access SQL Server from ActiveX.
In such I assume that you use the ActiveX Data Objects, that is ADO. David
Sceppa has a good book about ADO on Microsoft Press. It's a bit old, so I
don't know how easy it is to get hold of.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||"Erland Sommarskog" <esquel@.sommarskog.se> wrote in message
news:Xns959C688EF43EAYazorman@.127.0.0.1...
> Pippen (123@.hotmail.com) writes:
>> After re-reading my post I did not make myself very clear... Please let
>> me try again. I'm looking to find resources to write ActiveX code to
>> support my stored procs ect... I'm confused on what the built in ActiveX
>> compiler uses out of the VBScript language. All of the VBScript books I
>> pick up look like they are written for web designers. I'm looking for a
>> book or resource for writing code for the ActiveX compiler in MS-SQL.
> Since, as Dan said, no one really knows what ActiveX (save, possibly,
> for the marketers that invented the term), it may be easier if you told
> us what your business problem is.
> Now it sounds a bit like you are asking to access SQL Server from ActiveX.
> In such I assume that you use the ActiveX Data Objects, that is ADO. David
> Sceppa has a good book about ADO on Microsoft Press. It's a bit old, so I
> don't know how easy it is to get hold of.
> --
> Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
> Books Online for SQL Server SP3 at
> http://www.microsoft.com/sql/techin.../2000/books.asp

After doing a little more research I think what I'm looking for is a book or
resource that deals with using VBScript in a DTS package to extend the
functionality of the DTS package; namely the ActiveX task in the DTS
package. Every book that I have picked up on VBScript deals primarliy with
webpages.

I have a process that needs to send and receive files that are encrypted
with PGP on a daily basis. Each of the files have unique names so I will
need to read tables to find the files that need to be processed. These files
will be encrypted / decrypted in the VBScript and loaded or extracted from
the DB. I would have used batch files (MS system) if not for the unique file
names. Essentially I'm looking to increase my knowledge of using VBScript in
an ActiveX task for this project and future projects.

Sorry about the misuse of normenclature, SQL is not my primary language.

Thanks,

-p|||Pippen (123@.hotmail.com) writes:
> After doing a little more research I think what I'm looking for is a
> book or resource that deals with using VBScript in a DTS package to
> extend the functionality of the DTS package; namely the ActiveX task in
> the DTS package. Every book that I have picked up on VBScript deals
> primarliy with webpages.

I know very little about DTS, and even less about books on DTS. However,
SQL Server MVPs Darren Green and Allen Mitchell runs www.sqldts.com, and
you might find some good tips there.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp

Friday, February 24, 2012

Accessing the sample database in Visual Basic .net sqlDataAdapter

I need some help with accessing the sample databases with
the SqlDataAdapter.
After double-clicking on SqlDataAdapter in Visual
Basic .net. I click on new connection and choose
Microsoft Ole DB Provider for SQL Server as the
provider. Then under the connection tab, I enter (local)
as the server name. And Choose Use Windows NT Inegrated
Security. Then under databases in the server, only
master, model, msdb, and tempdb show up. The sample
databases Northwind and pubs don't show up, as well as
the database which I created called Project.
In the SQL Server Enterprise Manager, under Console Root -
> Microsoft SQL Server -> SQL Server Group -> CR304216-
A\Project[WindowsNT] -> Databases
I see master, model, msdb, Northwind, Project, pubs, and
tempdb.
So, why don't I see Northwind, Project, and pubs in the
sqlDataAdapter console?Hi, Sabrina!
I'm fairly new to VB.net, but I'm working hard at learning it each day.
Anyway, have you tried using the "sa" user name (or better yet... just the u
ser name and password to one of the databases you have access to)? I tend t
o not use the Windows security and go with the user name and password provid
ed for SQL Server instead (
I seem to have problems getting connections the other way).
I would try that and see what happens.
Hope that helps.
Rick
-- Sabrina wrote: --
I need some help with accessing the sample databases with
the SqlDataAdapter.
After double-clicking on SqlDataAdapter in Visual
Basic .net. I click on new connection and choose
Microsoft Ole DB Provider for SQL Server as the
provider. Then under the connection tab, I enter (local)
as the server name. And Choose Use Windows NT Inegrated
Security. Then under databases in the server, only
master, model, msdb, and tempdb show up. The sample
databases Northwind and pubs don't show up, as well as
the database which I created called Project.
In the SQL Server Enterprise Manager, under Console Root -
> Microsoft SQL Server -> SQL Server Group -> CR304216-
A\Project[WindowsNT] -> Databases
I see master, model, msdb, Northwind, Project, pubs, and
tempdb.
So, why don't I see Northwind, Project, and pubs in the
sqlDataAdapter console?

Sunday, February 19, 2012

Accessing Table From Visual Basic

I have a SQL table and I want to access it using the Visual Basic Code

but first I want to check whether the row is exist to update it or not exist so I can add new row. I have wrote this code but it doesn't work.

Set mydb2 = ceg.OpenResultset("select * from ProjCost where Mon='" _
& Format(SD, "dd/MM/yyyy") & "'", rdOpenDynamic, 3)
If mydb2.EOF Then
mydb2.AddNew
mydb2(0) = Trim(ProjNum)
mydb2(1) = Trim(ProjName)
mydb2(2) = Format(SD, "MM/dd/yyyy")
mydb2(3 + (mydb1(0) - 1) * 2) = Trim(Total)
mydb2.Update
Else
mydb2.Edit
mydb2(3 + (mydb1(0) - 1) * 2) = Trim(Total)
mydb2.Update
End If

can any body tell me what is wrong with this code as it's every time add a new record instead of updating the exisitng one

Thnx

Look at your query in Profler (or just output it into any debug window) and try to run it from QA, for examlpe.
P.S. Hint: datetime field may contain time as well, Then your query will return only rows with midnight time.

Thursday, February 16, 2012

accessing SQL Server Compact Edition from VBA

Is it possible to connect to SQL Server Compact Edition with Visual Basic for Application?

I want to connect to *.sdf file from MS Access.

I suppose you can do it using OLEDB if VBA allows you to use COM objects (which you should know better as I've never used VBA).

|||

Thanks. I also suspected that, just was not sure is there OLEDB provider version for desktops, and how to access it. Just foud that information in one of the mahdi posts

Dim cnx As ADODB.Connection
Set cnx = New ADODB.Connection
cnx.ConnectionString = "Provider='Microsoft.SQLSERVER.MOBILE.OLEDB.3.0.';Data Source='c:\\B.sdf';"
cnx.Open

Accessing SQL Server 2005 stored procedures from Visual Studio.NET

Hello,
What permissions do I need to set on our new SQL Server 2005 test server so that I can see the stored procedures, views and tables from Visual Studio development environment.

Example, I can see my older SQL Server 7 tables, edit them, write stored procedures, and so on. But while I can see the SQL Server 2005 and its databases, the folder underneath are empty and I cannot right-click to create New stored procedure or table.

My guess is that there is security involved, if so, what do I set on the new server?
If I'm wrong, and it's something else entirely, please advise.

Thanks!

See Books Online for answers on permission required by all database operations. For example, the command to create a table is CREATE TABLE - the Permission section of the article tells you what permission you need to have to be able to perform this operation.

Thanks
Laurentiu

Monday, February 13, 2012

Accessing SQL Database created in Visual Studio

I created an SQL database in Visual Studio 2005 Express Edition and would like to edit it in SQL Server Management Studio Express. The only databases listed in the Object Explorer of SQL Server MSE are the system databases (ones that are part of the SQL Server MSE).

If I dig through the directories, I can locate my database under the Visual Studio directory, but I am unable to open it. I get an error message stating, "There is no editor available for [my database]... Make sure the application for the file type (.mdf) is installed."

I'm sure that this is a ridiculously simple rookie mistake that I'm committing somehow, but I'm stumped. Any idea what I'm doing wrong?

What you need to do is "attach" your database in your management studio. This is supprisingly a goofy process, being that this is our newest implementation of a manager for SQL Express, here's some help to get you started.

http://msdn2.microsoft.com/en-us/library/ms190209.aspx

|||

I tried it, and I think that it should have worked, but it didn't. I got a long string of error messages. It's probably just another bug that Microsoft will some day issue a patch for. When I attempted to add my review of the tip to the msdn website my computer locked up. That was kind of a metaphor for the entire experience. I've learned my lesson. Don't make databases in Visual Studio - do it in SQL Studio or MySQL.

|||

I've never had an issue with the Management Studio, or SQL Express databases, I'm not sure what your experiencing, but they arent as unreliable as your making them out to be.

Sorry you couldnt get it fixed.

Sunday, February 12, 2012

Accessing remote SQL 2005 db using C# express edition

I have downloaded Visual C# express edition and SQL Server 2005 Express
Edition.
Installed Visual C# Express and SQL Server Express edition on Windows XP Sp2
and .NET framework 2.0
I am trying to write a C# program using ADO.NET to access a SQL 2000
database stored on a remote server Windows 2003 Sp1.
User logged in on this XP machine does not have rights on Windows 2003 serve
r.
Getting some kind of errors that login failed. And if I use user name and
password while connecting to SQL 2000 database getting some different errors
.
My questions are:
1. Is it possible with Visual C# express edition to access remote server SQL
db?
or do I need to use local database?
2. Is it possible to import SQL 2000 datbase in SQL 2005 Express edition?
Please advise.
Thanks in advance.Hi
1. If you are using windows authentication then there will need to be a
trust between the server and workstation if they are not on the same domain.
If you have mixed mode authentication then you may be able to use a SQL
Server login. Try connecting with osql first.
2. You can backup/restore from SQL 2000 to SQL 2005.
John
"SPD" wrote:

> I have downloaded Visual C# express edition and SQL Server 2005 Express
> Edition.
> Installed Visual C# Express and SQL Server Express edition on Windows XP S
p2
> and .NET framework 2.0
> I am trying to write a C# program using ADO.NET to access a SQL 2000
> database stored on a remote server Windows 2003 Sp1.
> User logged in on this XP machine does not have rights on Windows 2003 ser
ver.
> Getting some kind of errors that login failed. And if I use user name and
> password while connecting to SQL 2000 database getting some different erro
rs.
> My questions are:
> 1. Is it possible with Visual C# express edition to access remote server S
QL
> db?
> or do I need to use local database?
> 2. Is it possible to import SQL 2000 datbase in SQL 2005 Express edition?
> Please advise.
> Thanks in advance.
>

Accessing RDL Reports from Visual Basic 6.0 Application

Hai! I don't know is this a silly question. Is it possible to execute and display the rdl (Sql server 2005 reporting services) report from visual basic 6.0 application.

I have a full fledged Visual basic windows application and using crystal reports. I want to create the reports using SQL server 2005 reporting services and access it from my Visual Basic 6.0 Windows application.

Thanks in advance

I'm afraid VB6 support has ended, and so VB6 questions are off topic here. Try www.vbcity.com instead.

Accessing publication properties from Visual Basic (VB6)

Hi all,

I have an existing application that checks a few things before it
launches another application. One thing that the application needs to
check is the subscription properties of both the local database and the
remote (LAN) server.

I've stumbled upon some properties but I am trying to fit in the last
ones and I can't seem to find the right code to accomplish this... Can
anyone shine a little light on this please ?

The following code queries the SQL Server (remote) to get (some of) the
properties of the replicated database. What I would like to fit in
after the 'state' are the properties that you can retrieve with the
EnumAllSubscriptions function. However, I can't seem to find the right
object (sample code) to retrieve those (or I'm just overlooking the
obvious)...

Here is (part of) the code I'm using to query the publication on the
remote server :

Dim oMergePublication As SQLDMO.MergePublication2
Dim oSubscription As SQLDMO.MergeSubscription2

Me.lstPublications.Clear
For Each oReplicationDatabase In
objSQLSERVER.Replication.ReplicationDatabases
If oReplicationDatabase.Name = Me.txtSQLServerDatabase.Text
Then
For Each oMergePublication In
oReplicationDatabase.MergePublications
bFoundReplicated = True
Me.lstPublications.AddItem "Database replicated as
'" & oMergePublication.Name & "'"
For Each oSubscription In
oMergePublication.MergeSubscriptions
Me.lstPublications.AddItem " - subscriber
:" & oSubscription.Subscriber
Me.lstPublications.AddItem " - local
DB :" & oSubscription.SubscriptionDB
Me.lstPublications.AddItem " -
state :" & GetReplStatus(oSubscription.Status)
Next
Next
'For Each osubscriber In oReplicationDatabase.
'Next
End If
Next
Set oReplicationDatabase = Nothing
Set oMergePublication = Nothing

After this, I also want to check the local DB (=pulled subscription)
and show some of the properties (from EnumAllSubscriptions). For
example to warn the user about the need to synchronise (last_updated
value)...

Any help appreciated,

Many thanks

GB

--
Your eyes are weary from staring at the CRT. You feel sleepy. Notice
how restful it is to watch the cursor blink. Close your eyes. The
opinions stated above are yours. When I snap my fingers, you cannot
imagine why you ever felt otherwise. <snapI'm not sure what you're asking - do you mean that you know that
EnumAllScubscriptions will return the information you need, but you
don't know how to manipulate a SQL-DMO QueryResults object? If so, then
you need to iterate over it, and use the GetColumn% methods to return
the data in the format you want - in this case, GetColumnString is
probably the best one to use.

This is a simple VBScript example of using a QueryResults object:

Option Explicit

Dim oSrv, res, c, r

Set oSrv = WScript.CreateObject("SQLDMO.SqlServer2")
oSrv.LoginSecure = True
oSrv.Name = "MyServer"
oSrv.Connect

Set res = oSrv.ExecuteWithResults("select * from sysobjects")

For r = 1 To res.Rows
For c = 1 To res.Columns
If res.ColumnName(c) = "name" Then
WScript.Echo res.GetColumnString(r, c)
End If
Next
Next

If this isn't helpful, you might get a better answer in
microsoft.public.sqlserver.replication.

Simon|||Sort of Simon,

I'm having difficulty to get the returnset from EnumAllSubscriptions in
a workable object. It just returns nothing or won't compile.
In the code I've added, I managed to get the right call for the
EnumAllSubscriptions but I'm not sure on the syntax it requires. Like :

Dim oSubscription as SQLDMO.Subscriber2
Dim oSubscriptionData as SQLDMO.<??>
For each oSubscriptiondata in
oSubscription.EnumAllSubscribers(SQLDMOSubscriptio n_All)

OR do I need to make something like
Dim Result
Dim oSubscription as SQLDMO.Subscriber2
Result = oSubscription.EnumAllSubscribers(SQLDMOSubscriptio n_All)
and then walk that Result for the correct data

Thanks anyway. I'll give this a try in the .repication group.

GB

Simon Hayes bracht volgend ide uit :
> I'm not sure what you're asking - do you mean that you know that
> EnumAllScubscriptions will return the information you need, but you
> don't know how to manipulate a SQL-DMO QueryResults object? If so, then
> you need to iterate over it, and use the GetColumn% methods to return
> the data in the format you want - in this case, GetColumnString is
> probably the best one to use.
> This is a simple VBScript example of using a QueryResults object:
> Option Explicit
> Dim oSrv, res, c, r
> Set oSrv = WScript.CreateObject("SQLDMO.SqlServer2")
> oSrv.LoginSecure = True
> oSrv.Name = "MyServer"
> oSrv.Connect
> Set res = oSrv.ExecuteWithResults("select * from sysobjects")
> For r = 1 To res.Rows
> For c = 1 To res.Columns
> If res.ColumnName(c) = "name" Then
> WScript.Echo res.GetColumnString(r, c)
> End If
> Next
> Next
>
> If this isn't helpful, you might get a better answer in
> microsoft.public.sqlserver.replication.
> Simon

--
Your eyes are weary from staring at the CRT. You feel sleepy. Notice
how restful it is to watch the cursor blink. Close your eyes. The
opinions stated above are yours. When I snap my fingers, you cannot
imagine why you ever felt otherwise. <snap

Accessing printer settings in the sql reporting services 2000

I am using Visual Studio 2003 and SQL Reporting Services 2000. I am creating a Intranet based application which will be used by our company employees only. I want to know how can I set a printer, paper tray and paper size in the report settings, so that user need not to change the printer settings for each report. In the application some of the reports will be printed on pre-printed paper, some on the plain paper. and i want to print the reports which is not a defaul printer.

I did not find any solution yet... any ideas ... It will be a great help for me..