|
Hmmm, I've heard of this before.
OK, pain in the butt changing syntax between providers, but doable. Does this work with ODBC/MySQL? If so, we might have something here. I'll have to look into this more deeply.
Thanks.
|
|
|
|
|
David Bliss wrote:
pain in the butt changing syntax between providers
It just depends on what the back end database supports.
David Bliss wrote:
Does this work with ODBC/MySQL?
Should do.
If you want another reason to implement parameterised queries then you should know that it helps prevent SQL Injection Attacks[^]
Do you want to know more?
Vogon Building and Loan advise that your planet is at risk if you do not keep up repayments on any mortgage secured upon it. Please remember that the force of gravity can go up as well as down.
|
|
|
|
|
> Should do.
I'll have to check into it. Lord, I hope so. Keeping my fingers crossed.
> If you want another reason to implement parameterised queries then you should know that it helps prevent SQL Injection Attacks
Yea, I know about those. Although, In my case I doubt I would have to worry about that in an elementary school setting, but you never know I suppose. Also, This is not a web based product.
|
|
|
|
|
Another idea. I'm not sure if all databases support this (I think it is part of the ANSI SQL92 standard - but it may just be a Microsoft thing [sorry, that's not very definite])
You can supply semi-colon delimited SQL Commands.
SELECT * FROM TableA; SELECT * FROM TableB; SELECT * FROM TableC That might help, but I'm not sure about the update/insert/delete part of the data adapter.
Do you want to know more?
Vogon Building and Loan advise that your planet is at risk if you do not keep up repayments on any mortgage secured upon it. Please remember that the force of gravity can go up as well as down.
|
|
|
|
|
Yea, I already thought of that. Problem is, I need to use data returned from the second select statement to create the third. So that doesn't work.
Or, wait a minute "SELECT *" am i just supposed to get a copy of the entire damn database? That just seems wacky.
Is that how you are supposed to use datasets? Copy the entire database in its entirety!? Holy crap, what if there are thousands of records and you only need to deal with a couple?
See, the whole dataset concept just dosen't make any sense to me.
|
|
|
|
|
David Bliss wrote:
Or, wait a minute "SELECT *" am i just supposed to get a copy of the entire damn database?
No, no... I'm just being lazy when I'm typing my reply. And remember your WHERE clause to filter the data.
It is always best to specify a column list in a query. If you do that and you add columns to the table it won't affect pre-existing code which might expect a certain number or order of columns.
David Bliss wrote:
Is that how you are supposed to use datasets? Copy the entire database in its entirety!? Holy crap, what if there are thousands of records and you only need to deal with a couple?
I'm just thinking of one table in particular that I'm working on. Data is being generated at a rate of several million rows per year.
In SqlServer at least SELECT TOP xxx where xxx is the number of rows you want back is very useful.
Do you want to know more?
Vogon Building and Loan advise that your planet is at risk if you do not keep up repayments on any mortgage secured upon it. Please remember that the force of gravity can go up as well as down.
|
|
|
|
|
I thought not.
Yea, Yea I'm fairly familiar with SQL syntax and dealing with databases in general. Just not stored procedures, paramaterized querys or anything having to do with datasets or databinding.
|
|
|
|
|
Hye..how to write the code to check hardware status whether is function properly or not?
|
|
|
|
|
hi, when i execute a procedure in asp, the procedure only make 5 of 8 elements of a bucle, and if i execute this proc in query analizer or with a job the procedure make all perfectly.
Anyone could help me plz?
the procedure is:
CREATE PROCEDURE [guarda_navegacion]
AS
declare @cadena as nvarchar(500)
declare @cadena2 as nvarchar(500)
declare @cadena3 as nvarchar(500)
declare @resultado as nvarchar(1000)
declare @pagina as nvarchar(1000)
declare @npag as int
set @npag=1
declare Cnav cursor local for
select urlpag from navegacion order by urlpag asc
open Cnav
fetch next from Cnav into @pagina
while @@fetch_status=0
begin
if left(@pagina,4)='http'
begin
set @cadena='wget --restrict-file-name=nocontrol "'+@pagina+'" -O "d:\Inetpub\intranetdev\capturaimg\archivos\resultado'
set @cadena2=@cadena+cast(@npag as nvarchar(10))
set @resultado=@cadena2+'.txt"'
exec master..xp_cmdShell @resultado
print @resultado
set @npag=@npag+1
print cast(@npag as nvarchar(10))
end
fetch next from Cnav into @pagina
end
close Cnav
deallocate Cnav
select top 1 * from navegacion
GO
|
|
|
|
|
Have anybody use on your program? i`m having difficulties on it.
<italic>Work hard and a bit of luck is the key to success. You don`t need to be genius, to be rich.
|
|
|
|
|
I know this means that my recordset does not convert properly with the SQL table.....but how do I go about finding out what field is not right?
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Can anyone help me determine why I am getting the error "Object must implement IConvertible" when I execute the stored procedure? Below is the code. I have checked the stored procedure, database table column datatype and the sqldbtype and they are identical. So I am a little lost here. Any assistance is greatly appreciated.:
objConn.open
objCom = New SqlCommand("UPLOAD_A", objConn)
objCom.CommandType = CommandType.StoredProcedure
With objCom.Parameters
.Add("@col1", SqlDbType.Decimal, 9)
.Add("@col2", SqlDbType.Decimal, 5)
.Add("@col3", SqlDbType.VarChar, 6)
.Add("@Count", SqlDbType.Int)
End With
With objCom
.Parameters("@col1").Value = dt.Columns(0)
.Parameters("@col1").Precision = 11
.Parameters("@col1").Scale = 2
.Parameters("@col2").Value = dt.Columns(1)
.Parameters("@col2").Precision = 5
.Parameters("@col2").Scale = 4
.Parameters("@col3").Value = dt.Columns(2)
.Parameters("@Count").Direction = ParameterDirection.Output
End With
If objCom.ExecuteNonQuery() > 0 Then
'uploaded records
Dim iCount As Integer
iCount = objCom.Parameters("@Count").Value
Console.WriteLine(iCount)
Console.ReadLine()
Return True
Else
Return False
End If
|
|
|
|
|
cooldev wrote:
why I am getting the error "Object must implement IConvertible" when I execute the stored procedure?
So, do you get this when you ExecuteNonQuery() , or after that? What line does this error occur?
Do you want to know more?
Vogon Building and Loan advise that your planet is at risk if you do not keep up repayments on any mortgage secured upon it. Please remember that the force of gravity can go up as well as down.
|
|
|
|
|
This error is thrown on the ExecuteNonQuery() line.
|
|
|
|
|
Hi,
I am running an application across a network which uses SQL server. When It runs I get an error 'Login failed for user guest' in the application. When I run the application on the machine where the server is it runs fine.
How can I enable user access across a network to SQL Server?
Thanks for any help.
|
|
|
|
|
Are you using a trusted connection? If so does the user you are logged in as on the remote machine have an account on the SQL Server?
Do you want to know more?
Vogon Building and Loan advise that your planet is at risk if you do not keep up repayments on any mortgage secured upon it. Please remember that the force of gravity can go up as well as down.
|
|
|
|
|
Hi,
If your using the SqlServer across the network you should not mention trusted connection = true
if should specify as below
myConnectionString = "Initial Catalog=Northwind;Data Source=servername;User ID=username;password=;Integrated Security=SSPI;";
thx.
ramakrishna.j
|
|
|
|
|
The connection string i am using is as follows.
sql_connection_string = "server=MICMACLAPTOP;Integrated Security=SSPI;database=humantouchSQL;Connect Timeout=20";
I have tried the below string
sql_connection_string = "Initial Catalog=humantouchSQL;Data Source=MICMACLAPTOP;Integrated Security=SSPI;Connect Timeout=20";
But it still does not work.
Any other suggestions?
|
|
|
|
|
Try to check the connection string from http://www.connectionstrings.com/[^]. Good luck
A thousand mile of journey, begin with the first step.
APO-CEDC
Save Children Norway-Cambodia Office
|
|
|
|
|
Hi,
You should pass the username and password to get sqlserver connection.
thanks
ramakrishna
ramakrishna.j
|
|
|
|
|
If you're using a trusted connection, then make sure you log into the machine where you are running the app with an account that is also an account on the SQL Server database. (By your error message, it looks like you may have logged in as 'Guest.')
To check this, on the SQL Server instance, check in the Security folder, and add your account to the list, and in the Database Access tab, check the database that this account needs to access.
If you don't have rights to add a user to the server, then you will need to ask your DBA to do it for you.
|
|
|
|
|
I have created an application which uses an access database. All is working fine, when I connect to the database as follows:
string strConnection = "Provider=Microsoft.Jet.OLEDB.4.0;";<br />
strConnection += " Data Source=E:\\Web_Development\\famtree\\FamilyTree.mdb;";<br />
strConnection +=" user id=; password=;";<br />
conn = new OleDbConnection(strConnection);
However I now want to use odbc dsn, I have set up the DSN for this database with the name 'FamilyTree' therefore I have changed my code to the following:
string strConnection = "DSN=FamilyTree";<br />
strConnection +=" user id=; password=;";<br />
System.Data.Odbc.OdbcConnection conn = new System.Data.Odbc.OdbcConnection(strConnection);
However this gives the following error:
ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
What is the correct connection string to be used? Am I using the correct class to define the connection?
I'd be grateful for any assistance in setting up this connection to work....
Thanks, Richard
|
|
|
|
|
I believe that you just need the DSN name passed and nothing else. Try that.
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Try to check http://www.connectionstrings.com/[^] to solve your problem. Let me know if it is work or not. Good luck
A thousand mile of journey, begin with the first step.
APO-CEDC
Save Children Norway-Cambodia Office
|
|
|
|
|
Thanks, I have tried just DSN=FamilyTree but this acheives the same result... I originally did get the string to use from connectionstrings.com under DNS -> ODBC.
I guess that I am missing some parameters from the connection string, but don't know what they might be. Any more ideas? The alternative is to give up and use a MySQl or MSSQL database, but not sure if this would make any difference.
Richard
|
|
|
|