|
Do you have a Pentium 4 processor? If so, see here[^], especially the post from Bart-Jan Keetels.
|
|
|
|
|
Thank u ....it worked!!
|
|
|
|
|
With ref. to ASP.NET web application:
suppose there are two textbox (web form controls) , one reset button(HTML control) on the screen.
when the page is loaded for the first time,I enter some values in two textboxes and press reset button.
Values from the text boxes gets cleared on clicking the reset button. If I perform the same activity again reset button doesn't work.
|
|
|
|
|
|
I have windows 2000 professional edition installed on my system.
When I try to open a new project in ASp .NET web applications or web services, I get the following error:
"Visual Studio .NET has detected that the specified webserver is not running ASP.NET version 1.1. You will be unable to run ASP.NET web applications or
services."
Note that Webserver is running propery on my PC.
How to resolve this error?
|
|
|
|
|
This refers to the records returned by the "For XML auto" in ADO.Net.
The first case is simply retirning results from a select statement from a
table returning some columns with for xml auto.
--------------------------------------------
[No erros, results returned]
Database2, connection2
SqlConnection1.Open()<br />
Dim SQLCmd As New SqlClient.SqlCommand<br />
SQLCmd.Connection = SqlConnection1<br />
SQLCmd.CommandType = CommandType.Text<br />
SQLCmd.CommandTimeout = 20<br />
SQLCmd.CommandText = "SELECT CustomerID, CompanyName, City, PostalCode, Phone FROM Customers FOR xml auto"<br />
Dim myXmlReader As System.Xml.XmlReader = SQLCmd.ExecuteXmlReader()<br />
<br />
'myXmlReader.MoveToContent()<br />
'myXmlReader.MoveToElement()<br />
Response.Write("<table border='1'>")<br />
<br />
While myXmlReader.Read<br />
'Response.Write(myXmlReader.Item("CustomerID") & "<br>")<br />
Response.Write("<tr><td>" & myXmlReader.Item("CustomerID") & " " & myXmlReader.Item("CompanyName") & _<br />
myXmlReader.Item("City") & "" & myXmlReader.Item("PostalCode") & "</td></tr>")<br />
End While<br />
Response.Write("</table>")<br />
myXmlReader.Close()<br />
SqlConnection1.Close()<br />
[No errors, results returned]
-----------------------
The second case is, results expected to be returned from table joins using For xml auto. In this case no results were returned, no errors or exceptions, exactly same trace info as in the first case
[No errors, no output(empty table), trace info exactly same as the one with results returned]
Database1, connection string1
SqlConnection1.Open()<br />
Dim SQLCmd As New SqlClient.SqlCommand<br />
SQLCmd.Connection = SqlConnection1<br />
SQLCmd.CommandType = CommandType.Text<br />
SQLCmd.CommandTimeout = 20<br />
SQLCmd.CommandText = "SELECT nums.NumId, nums.Nums, color.colr FROM color INNER JOIN nums ON color.numid = nums.NumId FOR xml auto, ELEMENTS"<br />
'SELECT nums.NumId, nums.Nums, color.colr FROM color INNER JOIN nums ON color.numid = nums.NumId FOR xml auto<br />
'SELECT CustomerID, CompanyName, City, PostalCode, Phone FROM Customers FOR xml auto<br />
Dim myXmlReader As System.Xml.XmlReader = SQLCmd.ExecuteXmlReader()<br />
Response.Write("<table border='1'>")<br />
<br />
While myXmlReader.Read<br />
'Response.Write(myXmlReader.Item("CustomerID") & "<br>")<br />
<br />
Response.Write("<tr><td>" & myXmlReader.Item("nums.NumId") & " " & myXmlReader.Item("nums.Nums") & _<br />
myXmlReader.Item("color.colr") & "</td></tr>")<br />
End While<br />
Response.Write("</table>")<br />
myXmlReader.Close()<br />
SqlConnection1.Close()<br />
[No errors, no output]
What could be different?
|
|
|
|
|
Possibly the join yeilds no matches. Try the query in Query analyzer (first as a normal query, - no forXml, then just without the ELEMENTS directive).
Why would anyone waste time arguing with an accountant about anything? Their sole function is to record what happenned, and any higher aspirations are mere delusions of grandeur. On the ladder of productive contributions they are the little rubber pads at the bottom that keep the thing from sliding out from under you. - Roger Wright
|
|
|
|
|
That would be the first thing I would try. It does return resutls in Query Analyzer.
Thanks,
Happy New Year
Mysorian
|
|
|
|
|
how to make a case sensitive comparsion in sql ?
select * from users where Password = 'ahmed'
is the same
select * from users where Password = 'AhmEd'
how to make it case-sensitive ?
|
|
|
|
|
|
thanx for reply, but could u explain more ,
actually i'm not a proffessional with sql, so could u provide an example or just explain.
thanx in advance
|
|
|
|
|
Every time I run the code below, it tells me "No update permissions!"
<html>
<body>
<h2>Update Record</h2>
<%
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open(Server.mapPath("chem.mdb"))
cid=Request.Form("sh*t")
response.write(Request.Form("test1"))
jon = 1
response.write(jon)
if Request.form("test1")<>"" then
sql="UPDATE NEWS SET "
sql=sql & "DATE='" & now() & "',"
sql=sql & "CONTENT='" & Request.Form("test1") & "'"
sql=sql & " WHERE ID='" & jon & "'"
on error resume next
conn.Execute sql, Recordsaffected
if err<>0 then
response.write("No update permissions!")
else
response.write("Record " & cid & " was updated!")
end if
end if
conn.close
%>
</body>
</html>
|
|
|
|
|
RomanD wrote:
Every time I run the code below, it tells me "No update permissions!"
I would guess that there is an error in the SQL statement.
I would also guess that err does not necessariliy indicate a permissions problem, but your code assumes that any error must be a permissions problem. You should find out what err actually is, and find out what that error number actually means.
Do you want to know more?
WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and Forums
|
|
|
|
|
Could you update using this SQl from within MS Access?
|
|
|
|
|
Could you update using this SQl from within MS Access?
|
|
|
|
|
Here is my newest code:
sql="SELECT * FROM NEWS WHERE ID="&jon&";"
Set rsSrc = Server.CreateObject("ADODB.Recordset")
rsSrc.Open sql, oDBConn,0,3
if(not(rsSrc.EOF))then
rsSrc("DATE")= Now()
rsSrc("CONTENT")=Request.Form("test1")
rsSrc.update
end if
rsSrc.close
set rsSrc=nothing
Now, the error message I get is that my database/object is readonly. But I think that's a problem with my host.
|
|
|
|
|
I suspect that the user account that your ASP page is running under - typically IUSR_machinename - doesn't have NTFS write permissions to the directory that contains the .MDB file. Hence the database is opened read-only and you can't insert new rows or update or delete existing ones.
The account needs to be able to write to the directory, not just the file, as the Jet database engine needs to create an .ldb file if multiple connections access the file concurrently.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
I normally do like this..
if exists ( select * from Table1 )<br />
begin<br />
...<br />
end
But now I don't know Table1 until runtime so I did
declare @sql nvarchar(50)<br />
set @sql = 'Select * from'+@Table <br />
if exists ( exec (@sql) )
How can I achieve last line of code?? It is not working? How can I check the condition?
|
|
|
|
|
You can use the @@ROWCOUNT value to see if any row exists (@@ROWCOUNT <> 0 ). If you need to know if the table exists, I suggest you use the sysobjects table to see if the table exists. Here's a simple example:
<br />
<br />
DECLARE @sql varchar(50)<br />
DECLARE @table varchar(50)<br />
SET @table = 'Employees'<br />
SET @sql = 'SELECT * FROM '+ @table<br />
<br />
IF EXISTS(SELECT * FROM sysobjects WHERE [name] = @table AND xtype = 'U')<br />
BEGIN<br />
EXEC (@sql)<br />
IF @@ROWCOUNT <> 0<br />
BEGIN<br />
PRINT 'DATA FOUND!'<br />
END<br />
END<br />
Hope this helps!
~javier lozano
(blog)
|
|
|
|
|
It isn't something SQL is very good at and the answer, at least as best as I can find it, is not pretty.
DECLARE @result int
DECLARE @sql nvarchar(500)
SET @sql = 'IF EXISTS(SELECT * FROM '+@Table+
') SELECT 1 AS Result ELSE SELECT 0 AS Result';
CREATE TABLE #Result (Result int)
INSERT INTO #Result
EXEC(@sql)
SELECT @result = Result FROM #Result
IF @result = 1
BEGIN
-- This code is run if there are existing records in @table
END
DISCLAIMER: I typed this directly into Code Project, there may be errors
[EDIT]
Actually, after seeing Javier's solution I think that his is better on security grounds as it also helps protect against secondary sql injection attacks. Although, I would say that if your table contains a lot of rows then it would be slower as Javier's solution is returning all the rows in the table out of the Stored Procedure it is contained within in order to work out the number of rows.
[/EDIT]
Do you want to know more?
WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and Forums
|
|
|
|
|
Hi,
I would like to know how I can add/read user-defined properties to an MS Access DB using ADO.NET. I need to add a property such as version.
In DAO, one could do that using the "CreateProperty()" function, but here I'm stumped.
Thanks!
|
|
|
|
|
Hello
I think it's possible to export a .Net dll and use it from unmanaged code, using the utility tlbexp.exe, or regasm.exe, that export and registers it.
I'm trying to export System.Data.dll, that contains the most part of ADO.net, in order to use it in a MFC application. So, I do:
regasm /verbose /tlb:systemdata.tlb "c:\....\System.Data.dll"
but, it answers:
type SQLDebbuging was exported.
Why only SQLDebbuging type is exported? What happens with all the others?
Is there any way to use ADO.NET from unmanaged code?
Thank you very much for your help.
|
|
|
|
|
Hi, now I have a big trouble in vb.net and access. I have one table call tblTest with the following field:
ID Name
N01 Kagna
N02 Bopha
When I run the following SQL statement in access query: SELECT * FROM tblTest WHERE tblTest.ID LIKE 'N*' then the result return both row. But when I run the same SQL statement from VB.NET it did not return any row. But if I run the following SQL statement SELECT * FROM tblTest WHERE tblTest.ID LIKE 'N01' from VB.NET then it return 1 result (the N01). I don't what is the problem that cause in VB.NET, I really in a difficult situation now because the result did not return as what I expected. Here is my code:
Dim cnnSearch As New ADODB.Connection
Dim rstCat As New ADODB.Recordset
With cnnSearch
.Open(strConnection)
.CursorLocation = ADODB.CursorLocationEnum.adUseClient
End With
rstCat.Open("SELECT * FROM tblTest WHERE tblTest.ID LIKE 'N*'", cnnSearch, _
ADODB.CursorTypeEnum.adOpenKeyset, _
ADODB.LockTypeEnum.adLockOptimistic)
Note: I'm using VB.Net and connect to database using ADODB.
A thousand mile of journey, begin with the first step.
APO-CEDC
Save Children Norway-Cambodia Office
|
|
|
|
|
You could try the MS-SQL syntax, and use % instead of *:
SELECT * FROM tblTest WHERE tblTest.ID LIKE 'N%'
Wout Louwers
|
|
|
|
|
I also try to use it, but it is not working. But as far as I know use % if we working with SQL server. But in this case I use Ms access so I have to use * instead of %. What I wonder is the same statement in Ms access is working while in vb.net is not working... Until now what I suspect is because I did not use ADO.NET in VB.NET. I use COM technology by adding the reference from the COM tab of Add new reference dialog. As the code above, if I use in vb6 is working fine, may be I have to test ADO.NET in vb.net make sure it is working or not.
A thousand mile of journey, begin with the first step.
APO-CEDC
Save Children Norway-Cambodia Office
|
|
|
|