|
Thanks for your reply. I'll give C# a look. If it's as intuative as it's supposed to be, then there should be no real trouble.
thanks
Greg
|
|
|
|
|
Have used ADO from CPP before, and TBH, pretty much as you'd expect - more hassle to set it up, more hassle to use it, and the results are the same - since ADO itself is written in CPP, there's no performance enhancement for the ADO calls.
If you do go down the CPP route, would suggest that you #import the dll, and get the TLI / TLH generated - simplifies things! Having said that, if using CPP, why not just use OLEDB?
"Now I guess I'll sit back and watch people misinterpret what I just said......"
Christian Graus At The Soapbox
|
|
|
|
|
I think I understand. It's just, (and I've been a commerical programmer for some time) I don't want to learn yet another language. I've been resisting C# for some time.
I guess you just have to keep going.
Thanks
Greg
|
|
|
|
|
Hi all,
I tried to connect to an MSSQL 2k server using a secured (SSL) connection by enabling SSL support on either server side (installed CA and enabled the secured option) or client side (enable "Use data encryption" in ADO connection string). If I use the option on server side, it works ok. But I want to use client-side enabled secured channel, not server-side. When I tried to connect, the ADO connection reported error like: "SSL Security error.... SECDoClientHandShake()". I tried to import the CA to trusted root on client computer but still not work !?.
Currently I just want to make sure just specific clients (allowed) can connect to my SQL server using secured channel (by validate CA or something) but I dont know how.
Anyone can help?
Thanks very much.
Zro
|
|
|
|
|
And another problem: If the client connects to a secured enabled SQLServer, how can that client know the connection is secured or not? is there any properties/methods of ADO ConnectionPtr to detect that?
|
|
|
|
|
I dont have SQL server, just an XML file on my hard drive.
How do i use Server Explorer to build aconnection to that XML file?
I can, so far, load the file into a dataset using:
DataSet MDS = new DataSet();
MDS.ReadXml("C:\\Students.xml");
But this doesnt allow for manipulaiton e.g: SELECT, DELETE, INSERT INTO, etc....
Does it??
I've had a bash conecting to an Access database and mangaed to manipulate it and do every thing i need to really.... But i need to be able to do this with an XML file and the informaiton in : Developing Windows Based Applictions seems a bit thin with regards connecting to and altering XML files.
Thanks
|
|
|
|
|
It's not a server, why would server explorer connect to it ? Why do you need to put it into a dataset, instead of an XmlDocument ? I have no idea how far the Xml support goes in a DataSet, but I know you can perform selects on a datatable, at least.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Can you give me an example of how i would perform a select on a DataSet please?
The only methods i have read in the book involve using the SqlConnection
i.e
string MyCom ="SELECT * WHERE id = 001"
SqlCommand MySqlCom = SQLCONNECTION.CreateCommand();
MySqlCom.CommanText = MyCom;
etc...
As you can see doing that requires you to refference the SqlConnection. So having no connection means i couldnt select in this way (and its the only way i have used up to now).
Also the Access files i have been using are not servers either but you can ad them through server explorer ??
|
|
|
|
|
JDUK wrote:
Also the Access files i have been using are not servers either but you can ad them through server explorer ??
Yes, because they are in fact a database.
The DataView has a RowFilter which basically operates like a select. I thought there was another object which held a table and took a select, but I could be thinking of that one.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Hi
I'm creating insert command object with command builder and then adding "; SELECT SCOPE_IDENTITY() as primary_key_field" formula to CommandText property of this object. I'm also setting its UpdateRowSource property to FirstReturnedRecord.
After calling update method of data adapter I do not get new
primary key value.
I did the same without using command builder (I've created insert command object in code "manually" and it's identical to the one which is created by the command builder) and everything seems to work fine. Does someone have any idea why retrieving autoincrement value doesn't work when I use CommandBuilder?
Thanks for any clues
Maciek
ps. If you need to see a code example, just let me know.
|
|
|
|
|
I have the myfile.mdb in sub-folder database, sometime I want to delete it but after I do the following (correct location), it is still there:
<br />
set fs=Server.CreateObject("Scripting.FileSystemObject") <br />
<br />
set f = fs.GetFile("\database\myfile.mdb")<br />
f.Delete[True]<br />
<br />
set f=nothing<br />
set fs=nothing<br />
Does anyone know how to do it differently?
Thanks
|
|
|
|
|
Are there any open connections to the database (does the .ldb file exist)?
If the database is in use, you won;t be able to delete it.
What does Delete return?
store your internet favourites online - www.my-faves.co.uk
|
|
|
|
|
Can anyone please help me on the error handling?
This code below is belongs to SQL.
I'm doing in Access.
Catch ex As Exception
if ex.Number = 2627 <---- ex.Number is not support in system.data.OleDb.
Any solution?
Please help.
Try
myCommand.ExecuteNonQuery()
Message.Style("color") = "DarkBlue"
Message.InnerHtml = "Record is created successfully."
Catch ex As SqlException
If ex.Number = 2627 Then
Message.InnerHtml = "ERROR: A record already exists with " _
& "the same primary key"
Else
Message.InnerHtml = "ERROR: Could not add record, please " _
& "ensure the fields are correctly filled out"
Message.Style("color") = "red"
End If
End Try
|
|
|
|
|
The exception class SqlException exposes a property called Number . The OleDbException class does not. If you're using OleDb against an Access database, you'd want to determine how the "primary key" error is reflected in OleDbException - take a look at OleDbException in the SDK documentation.
OleDbException does provide an ErrorCode property and an Errors collection - both may be useful for this purpose. I don't know what ErrorCode is returned on a "primary key already exists" error, but you could find out easily enough catching the OleDbException , setting your Message.InnerHtml value to the ErrorCode , and running a test where you try to insert a duplicate record.
|
|
|
|
|
hi,
How could i save a image save into a sqlserver image field to hard drive?
Thanks
|
|
|
|
|
|
|
Hi can anyone pleez assist me, i am trying to sort my db results by first letter... ie a, b, c etc how would i go about this using SQL. i want to be able to select a letter and have it order my all results by that chosen letter.
Thanks very very much
Butch
|
|
|
|
|
SELECT foo FROM bar ORDER BY SUBSTRING(foo,1,1)
|
|
|
|
|
thanks very much pbpb this has proved to be very useful.
thanks again
|
|
|
|
|
how can i copy the diagrams from a db to another?
(backup/restore is not an option since the a few differences between them)
//Roger
|
|
|
|
|
Here you go:
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q320125
|
|
|
|
|
I am trying to write a small app to map out sql server logins that are no longer mapped to any databases. simple enuff. got the algorithm worked out. however having problem with ado.net returning varbinary value to compare against.
First i create a reader (a) with the following query: "select name,sid from master.dbo.syslogins"
Then I create a reader (b) with the following query: "select name from master.dbo.sysdatabases"
Everything okay so far.
Now I want to loop through each login and check to see if the sid is mapped to any user in the databases.
So I create a query as such:
cString = select count(*) from " + b["name"].tostring() + ".dbo.sysusers where sid = " + a["sid"].tostring();
then next statement is to setup a sqlcommand and executeacaler the cString query.
I go through with the debugger and check to see what the value of cString becomes and everytime it is translated to:
"select count(*) from Broadband.dbo.sysusers where sid = System.Byte[]"
this generates a sql exception error. I can put single quotes around it but it still looks like:
"select count(*) from Broadband.dbo.sysusers where sid = 'System.Byte[]'"
this does not generate a sql exception but neither does it work. no sid values equals the string System.Byte[]
Need help.
cpritt
|
|
|
|
|
If the variable 'a' is a SqlDataReader (or any data reader, for that matter), you have a whole slough of methods to convert the data. Try a.GetString(1) to get a string value from a["sid"], or try a.GetInt32(1) to get an int value.
|
|
|
|
|
variable "a" is a SqlDataReader. I have tried the other options like a.GetSqlBinary(1) and everything still is being interpreted as System.Byte[].
what i mean is that the c# text:
cString = "Select whatever where sid = " + a.GetSqlBinary(1)
is sent to sql server as "Select whatever where sid = System.Byte[]"
whereas a SqlException is generated.
what i want is:
"Select whatever where sid = 0x27FA32BE455789"
not sure how to get this
|
|
|
|