|
SVb.net wrote: how i make a gloabl Variable As @@language?
Nope. You can't do it. These variables are defined by Microsoft.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hi all,
I got a security problem here,
let's say I got a SQL Report Server, with browser URL : //rptserver/reports
I have datasource1 as datasource
I also have provide a model (RptModel1) that created from datasource1 using Visual Studio
I want to enable users to use Report Builder , using available model(RptModel1) but restrict them from regenerate model from datasource1.
So, how to secure that datasource?
I need your help,Please...
Thanks in advance
|
|
|
|
|
Is there something wrong in my question so no one understand it? Or maybe there's no solution for my problem? :->
|
|
|
|
|
Is there any command which is equivalent to sequence in Oracle.
Or some thing to no the rows.
Best Regards,
M. J. Jaya Chitra
|
|
|
|
|
It depends on the type of database. Under SQL-Server you can use:
create table MyTable (
Id integer identity(1,1),
OtherData varchar(10)
)
go
insert into MyTable (OtherData)
values ('hello')
select SCOPE_IDENTITY() as AllocatedNumber
go Regards
Andy
|
|
|
|
|
In Oracle , we can use the following statement
Create table MyTestTable (Select * from OriginalTable)
Such that a new table will be created from the original table and the values will be inserted to it.
But what is the equivalent for the same in SQL Server.
Can any one suggest me.
Best Regards,
M. J. Jaya Chitra
|
|
|
|
|
|
But I don't know the columns I am going to retrieve based on the specification given by the user, I have to retrieve the data and that has to be stored to the table. So the table must be a temporary table with a key value which is auto generated.
Best Regards,
M. J. Jaya Chitra
|
|
|
|
|
I know this is dealing in ancient technology, but MS Access hasn't yet breathed its last. I copy an mdb template to a temp mdb file, write stuff to the copy using an OleDbConnection, and then close the connection. Next, I want to rename the file, but I can't. The ldb file is still there and I get the error that the file is being accessed by another process. I can copy the file to the new name, but I can't rename or delete the file.
Really aggravating is that this doesn't happen when the finished mdb file is under some size threshold. Then, the ldb goes away immediately when the connection is closed.
I've tried connection.Dispose(); connection=null; OleDbConnection.ReleaseObjectPool(); GC.Collect(); None of those release the process lock on the file. It won't release until my application terminates, which is a bit too late.
Is there any help for this?
|
|
|
|
|
Can anyone here help me please and tell me how can i establish a DATA connection in C++, that work with OLE DB?
I would like from my C++ Programm(Visual Studio 2005)to connect the MS SQL Server 2005 through OLE DB, but i do not have any idea how to do this, this field is new for me.
I istalled already MDAC 2.8, which it contains the OLE DB, and furthermore i can not do any thing, i do not even what is the next step is. Do i have MDAS 2.8 or not ?
I searched the whole day in the Internet, but without any success. What could help me is a small applicable example in C++, that describes how can i make a connection how can i inquire(call) the DB.
Another thing, should i set somthing in the Comp. or install somthing else?
Can anyone help me please or tell me where i can find the acquired information?
Regards in Advance
FreeEagle
|
|
|
|
|
If you continue to attempt to use this site DO NOT CROSS POST
|
|
|
|
|
Hi,
I am using Access 2003 and I can't seem to find out what is wrong with my INNER JOIN. There are 2 foreign keys in my Customer table namely TitleId and RegionId.
Here is my code:
SELECT t.TitleId, t.TitleName, c.CustomerId, c.FirstName, c.LastName, c.Mobile, c.Email, r.RegionId, r.RegionName
FROM Customer c
INNER JOIN Title t ON c.TitleId = t.TitleId
INNER JOIN Region r ON c.RegionId = r.RegionId
WHERE c.CustomerId = intCustomerID;
The error is:
Syntax error (missing operator) in query expression 'c.TitleId = t.TitleId INNER JOIN Region r ON c.RegionId = r.RegionId'.
Please can someone advise.
Regards
|
|
|
|
|
.NET Enthusiast wrote: SELECT t.TitleId, t.TitleName, c.CustomerId, c.FirstName, c.LastName, c.Mobile, c.Email, r.RegionId, r.RegionName
FROM Customer c
INNER JOIN Title t ON c.TitleId = t.TitleId
INNER JOIN Region r ON c.RegionId = r.RegionId
WHERE c.CustomerId = intCustomerID;
What is intCustomerID? Is it a variable? I don't see how it fits in with your SQL code.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Hi,
Here is my code that I am trying to get to work in Access:
CREATE PROC procGetCustomer(intCustomerID LONG) AS SELECT
t.TitleId,
t.TitleName,
c.CustomerId,
c.FirstName,
c.LastName,
c.Mobile,
c.Email,
r.RegionId,
r.RegionName
FROM Customer c
INNER JOIN Title t ON c.TitleId = t.TitleId
INNER JOIN Region r ON c.RegionId = r.RegionId
WHERE c.CustomerId = intCustomerID;
Does it make better sense?
Thanks
|
|
|
|
|
I took the books online sample and modified it with my data. When I run the query it sends the email, with the Header, and nothing else. The Table data never shows. Here is the code I used;
USE NMS_RT
DECLARE @tableHTML NVARCHAR(MAX) ;
SET @tableHTML =
N'<H1>MCP Alarms for previous 24 Hours</H1>' +
N'<table border="1>' +
N'<tr><th>Wayside_Name</th><th>ST</th><th>Alarm_Message</th>' +
N'<th>Error_Count</th><th>Error_Date</th><th>Alarm_State</th></tr>' +
CAST ( ( SELECT td = RT_MCP_Name, '',
td = RT_MCP_State, '',
td = RT_MCP_Alarm_Text, '',
td = COUNT(RT_MCP_Alarm_Text), '',
td = CONVERT(char(10), RT_MCP_Date_Time, 111), '',
td = RT_MCP_Bit_State, ''
FROM RT_MCP_Historic_Alarms
WHERE [RT_MCP_Date_Time] >= Convert(char(10), DateADD(DAY, -1, GETDATE()), 101) AND [RT_MCP_Date_Time] < Convert(char(10), GETDATE(), 101) and RT_MCP_Bit_State > 0
GROUP BY RT_MCP_Name, RT_MCP_State, RT_MCP_Alarm_Text, RT_MCP_Bit_State, CONVERT(char(10), RT_MCP_Date_Time, 111)
HAVING COUNT(RT_MCP_Alarm_Text) >= 10
ORDER BY CONVERT(char(10), RT_MCP_Date_Time, 111), COUNT(RT_MCP_Alarm_Text) DESC, RT_MCP_Name, RT_MCP_State, RT_MCP_Alarm_Text, RT_MCP_Bit_State
FOR XML PATH('tr'), TYPE
) AS NVARCHAR(MAX) ) +
N'</table>' ;
EXEC msdb.dbo.sp_send_dbmail
@recipients='user@anywhere.com',
@subject = 'MCP Alarms for Previous 24 Hours',
@body = @tableHTML,
@body_format = 'HTML',
@profile_name = 'test';
Any suggestions?
|
|
|
|
|
The answer was a simple. I missed a double quote in this field;
N'<table border="1>' It should read this N'<table border="1">'
|
|
|
|
|
hi there,
i have a problem that is when i try to copy my sql database files it gives error that "Cannot copy : It is being used by another person or program"
however i just start my pc but it gives the error
i also checked it by task manager and found some sql applications that are the cause of it, if i end them then my app. dont work
is there any way that i can copy my database files?
thanks
Becoming Programmer...
|
|
|
|
|
You can't copy the data files if the database is in use.
You should take the database offline if you want to copy the data files. Alternatively, you could take a backup of the database which doesn't require it to be taken offline.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
how can i offline database?
Becoming Programmer...
|
|
|
|
|
Right-click the database in Management Studio, select 'Tasks' and 'Take Offline'.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
thanks dude
rated 5
Becoming Programmer...
|
|
|
|
|
hi,
i have formed query using several joins. Now that i want the data to be unique, so thuoght of using 'distinct' but it does not seem to help.
There is a column named Id in the query and i dont want this to be duplicated hence i gave select distinct(id), .......
but this showed up some error. when using distict it is applying for the entire row, so its checking for each and evry column. Is it possible to use distinct keyword for one or two coulmns instead for the entire row i.e. all columns
gauthee
|
|
|
|
|
gauthee wrote: Is it possible to use distinct keyword for one or two coulmns instead for the entire row i.e. all columns
No. Adding the DISTINCT keyword specifies that only unique rows can appear in the resultset.
You should add a GROUP BY clause to your query and group on the fields where you do not want duplicate values in the resultset.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
hi All
i have this Stored Procedure, i want to use it in my VB.NET to Accept intoput and put a record in the table
Create Proc Insert_Client
(@inClientName varchar(30),
@inContactPerson Varchar(30),
@inClientAddress Varchar(38),
@inClientTelephone varchar(15),
@inClient_Cell_NO varchar(15),
@inSerialNumber varchar(30),
@inProduct_Status int,
@inClient_Email varchar(34))
as
insert into Clients (Client_Name,Contact_Person,Purchase_date,Client_Address,Client_Telephone, Client_Cell_NO,SerialNummber,Product_Status,Client_Email)
Values(@inClientName,@inContactPerson,Getdate(),@inClientAddress,@inClientTelephone, @inClient_Cell_NO, @inSerialNumber,@inProduct_Status,@inClient_Email) .
So i created a method and this method like this
Public Sub AddContacts(ByVal ClientName As String, ByVal ContactPerson As String, _
ByVal ClientAddress As String, ByVal ClientTelephone As String, _
ByVal Client_Cell_NO As String, ByVal SerialNumber As String, _
ByVal Product_Status As Integer, ByVal Client_Email As String)
Dim con As SqlConnection
Dim cmd As New SqlCommand
cnClients = New SqlConnection
'Declaring the Parameters
Dim prmClientName As New SqlParameter
Dim prmContactperson As New SqlParameter
Dim prmClientAddress As New SqlParameter
Dim prmTelephone As New SqlParameter
Dim prmClient_Cell_No As New SqlParameter
Dim prmSerialNumber As New SqlParameter
Dim prmProduct_status As New SqlParameter
Dim prmClient_Email As New SqlParameter
con = New SqlConnection(constr)
cmd.Connection = con
'Adding a Paramer
cmd.Parameters.Add(prmClientName)
With prmClientName
.ParameterName = "inClientName"
.SqlDbType = SqlDbType.VarChar
.Size = 30
.Value = ClientName
End With
'Adding a Paramer
cmd.Parameters.Add(prmContactperson)
With prmContactperson
.ParameterName = "inContactperson"
.SqlDbType = SqlDbType.VarChar
.Size = 30
.Value = ContactPerson
End With
'Adding a Paramer
cmd.Parameters.Add(prmClientAddress)
With prmClientAddress
.ParameterName = "inClientAddress"
.SqlDbType = SqlDbType.VarChar
.Size = 38
.Value = ClientAddress
End With
'Adding a Paramer
cmd.Parameters.Add(prmTelephone)
With (prmTelephone)
.ParameterName = "inClientTelephone"
.SqlDbType = SqlDbType.VarChar
.Size = 15
.Value = ClientTelephone
End With
'Adding a Parameter
cmd.Parameters.Add(prmClient_Cell_No)
With prmClient_Cell_No
.ParameterName = "inClient_Cell_No"
.SqlDbType = SqlDbType.VarChar
.Value = Client_Cell_NO
.Size = 15
End With
'Adding a Parameter
cmd.Parameters.Add(prmSerialNumber)
With prmSerialNumber
.ParameterName = "inSerialNumber"
.SqlDbType = SqlDbType.VarChar
.Value = SerialNumber
.Size = 30
End With
'Adding a Parameter
cmd.Parameters.Add(prmProduct_status)
With prmProduct_status
.ParameterName = "inProduct_status"
.SqlDbType = SqlDbType.Int
.Value = Product_Status
.Size = 4
End With
'Adding Parameter
cmd.Parameters.Add(prmClient_Email)
With prmClient_Email
.ParameterName = "inClient_Email"
.SqlDbType = SqlDbType.VarChar
.Value = Client_Email
.Size = 30
End With
cmd.CommandText = "Execute Insert_Client"
con.Open()
cmd.ExecuteNonQuery()
con.Close() .
And this method will be called in my form like this
Dim WS As Admin_DAL.Clients
Try
WS = New Admin_DAL.Clients
WS.AddContacts(txtname.Text, txtcontactperson.Text, txtadress.Text, txttelephone.Text, txtcellnumber.Text, txtserialnumber.Text, CInt(cmbstatus.Text), txtemail.Text)
Catch ex As SqlClient.SqlException
MsgBox(ex.Message)
End Try
.
Now,am accepting input from the vb form textboxes. the above code will be in my save button. when i try to save i get the Following Error.
Line1:Incorrect syntax near 'inClientName'. .
Remember i have declared this in the Procedure.
Thanks
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
Missing an @
With prmClientName
.ParameterName = "@inClientName"
.SqlDbType = SqlDbType.VarChar
.Size = 30
.Value = ClientName
End With
|
|
|
|
|