|
What is a named variable and why use it?
The variable @namedVariable is a "named variable."
The "@" prefix is required for SQL Server named parameters.
|
|
|
|
|
kenn_rosie wrote: What is a named variable and why use it?
It can be used like a variable in a stored procedure, or passed as a parameter to a query.
Why use a variable in any programming language?
Also, for security in passing data through from client applications. See SQL Injection Attacks and Tips on How to Prevent Them[^]
ColinMackay.net
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
|
|
|
|
|
Hi,
Whenever a user modifies a customers data I create a log with only the id’s(int) and the datemodified(datetime). Then I want to view the 10 latest customers that the user modified, sorted by datemodyfied and with unique customernames.
So I want to select Customers.customerid and Customers.customername sorted by entries in table CustomerLogs, sorted by CustomerLogs.datemodified. No doubles of customername allowed.
I’ve tried some different joins but nothing works exactly as I want.
In a WHERE clause I have author_userid=2 AND owner_companyid=1
Can somebody give some advice, please?
I use SQL Server 2000
TABLE Customers
Customerid | customername
TABLE CustomerLogs
customerlogid | customerid | author_userid | datemodified | owner_companyid
|
|
|
|
|
I think it may look something like this:
SELECT TOP 10
Customers.customerid,
Customers.customername,
Log.LastModified
FROM
Customers
INNER JOIN
(SELECT customerId, Max(dateModified) AS LastModified
FROM CustomerLogs
GROUP BY customerId) as Log
ON (Customers.customerId = Log.customerId)
ORDER BY LastModified DESC
If your log is large - you will want an index on (customerId, dateModified)
|
|
|
|
|
Thanks Michael!
You really made my day!
Your solution works excellent!
Have a nice day!
|
|
|
|
|
I need to sort a column using dynamic sort order.
I have a table name Account with three fieds. Type, Balance and Category.
Type can be Assets,Liablity,Revenue and Expenses
Balance is Debit or Credit
Category can be Current Assets,Net Property and Equipment, Non current Assets, Current Libality,
Long Term Liablities, Equity ,Sales , Cost of Sales ,
I need to sort the category column and Type column in a dynamic order. The above order and not ascending and descending.
Is there any way i can do that.
I tried the below example but gives me syntax error
SELECT Type,Balance,Category, sort_order = (CASE WHEN Category ="Current Assets" THEN 1
ELSE WHEN Category = 'Net Property and Equipment'THEN 2
ELSE WHEN Category ='Non current Assets' THEN 3
ELSE WHEN Category ='Current Libality' THEN 4
ELSE WHEN Category = Long Term Liablities'THEN 5
ELSE WHEN Category = 'Equity' THEN 6
ELSE WHEN Category = 'Sales' THEN 7
ELSE WHEN Category ='Cost of Sales' THEN 8
ELSE 0 END)
FROM Account;
smile8691
|
|
|
|
|
The sort_order column is only used for determining the order in which the rows are returned and not required otherwise.
SELECT Type,Balance,Category
FROM Account
ORDER BY (CASE WHEN Category ="Current Assets" THEN 1
ELSE WHEN Category = 'Net Property and Equipment'THEN 2
ELSE WHEN Category ='Non current Assets' THEN 3
ELSE WHEN Category ='Current Libality' THEN 4
ELSE WHEN Category = Long Term Liablities'THEN 5
ELSE WHEN Category = 'Equity' THEN 6
ELSE WHEN Category = 'Sales' THEN 7
ELSE WHEN Category ='Cost of Sales' THEN 8
ELSE 0 END);
ColinMackay.net
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
|
|
|
|
|
Thanks.
fsdfsdfsdfsdfsdfsdf
|
|
|
|
|
I have two servers which I am trying to get merge replication working with. The kicker of this issue is that the servers are running on non-standard ports. So, my usual connection string of SERVER01\SQLInstance,1234 (1234 being the non-standard port) and SERVER02\SQLInstance,1234 which works for sqlcmd and sqlwb as well as a .NET application will not work for SQL Replication.
When I include the port in my connection string (SERVER01\SQLInstance,1234), which otherwise works, for a subscription, I get the error:
SQL Server replication requires the actual server name to make a connection to the server. Connections through a server alias, IP address, or any other alternate name are not supported. Specify the actual server name 'SERVER02\SQLInstance'. (Replication.Utilities)
But when I use no port (SERVER01\SQLInstance), I get this error:
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) (Microsoft SQL Server)
Any ideas on how to proceed?
|
|
|
|
|
Are both servers working on SQL2005 or just one.
There seems to be problems moving data from 2000 to 2005 viseversa
|
|
|
|
|
Hai
When i try to attach a DB that was detached from another SQL Server 2005 instance. i got this error
The database 'Content' cannot be opened because it is version 611. This server supports version 603 and earlier. A downgrade path is not supported.
Could not open new database 'Content'. CREATE DATABASE is aborted. (Microsoft SQL Server, Error: 948)
How can i slove this Error, since i am using a higher version ?
Regards
-- modified at 5:24 Wednesday 11th January, 2006
|
|
|
|
|
It looks like you developed the database on SQL Server 2005, release version, and are trying to restore it to a SQL Server 2005 June CTP release. That's not going to work and there is no conversion tool to make it work either.
You'll have to script the database out to an SQL file, export the data to another file, then run the script on the older SQL Server installation and import the data.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hi,
I am trying to bind the dataGrid to the dataset.I am getting the following error
Login failed for user 'XXXX\ASPNET'.
I am using the server explorer in the VISUAL STUDIO.NET to create the connetion and data adapter.I dragged the table from the server explorer.
The database in the server Explorer is connected using the windows authentication.
Can any one explain me why I got this error and How to resolve this error.
Thanks,
Satish.
satishrg
|
|
|
|
|
satishrg wrote: Can any one explain me why I got this error
Because your ASP.NET application runs in its own limited security context to protect your machine from mallicious attack via the web. SQL Server has not granted any permissions to this account.
satishrg wrote: How to resolve this error
You need to create a login in SQL Server to the account named and then to grant that login permission for the database you want to use and the objects (tables, views, stored procedures, functions) that are called by the application. Do NOT under any cicumstances put your ASPNET user in SQL Server in the sysadmin group because then if there is a hole in the security in the way your web application talks to the SQL Server you've just given the attacker carte blanche to do anything they like with your database and potentially with your OS.
ColinMackay.net
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
|
|
|
|
|
Hello,
I have a stored procedure that when run directly from SQL Management Studio (with SQL Server 2000) takes about 2 or 3 seconds at most to return around 40 rows.
When I try to call that SP from my code using a data adapter, it times out (and I set the timeout to 5 minutes ). It happens always. If I limit the results I want to 2 or 3 rows, calling the SP directly takes less than a second, and from my app it takes about a minute.
I tried using a data reader and it's just as slow.
I create the connection just before creating the data adapter, and I let the Fill call open it. But for the data reader attempt, I opened the connection myself. No luck, still as slow.
[EDIT: And I tried running the app locally (same machine as SQL Server) and from another machine in the network. Same results.]
Any ideas? This is driving me nuts!
Thanks in advance,
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005
-- modified at 23:03 Tuesday 10th January, 2006
|
|
|
|
|
Please, point out more detail problem (such as table structure, SQL statement...) so you can reach a help
|
|
|
|
|
Well, it's a complex SP, where I build a temporary table, and then I have a query with several subqueries to this temproary table. I'm at home now, so I don't have the code until tomorrow morning, and I'll be glad to post it if it helps.
What's bugging me is that only the call to the SP through the data adapter is slow, and if I run the SP directly form SQL Management Studio, it runs nicely in under 3 seconds at most.
Thanks for the reply, and I'll post the code here first thing in the morning.
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005
|
|
|
|
|
This is the code that calls the SP:
SqlCommand cmd = new SqlCommand("Reportes_RecoleccionHistoricaDiaria",
App.GetConnection(false));
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@ID_semana1", weekFrom);
cmd.Parameters.Add("@ID_semana2", weekTo);
cmd.CommandTimeout = 300;
SqlDataAdapter da = new SqlDataAdapter(cmd);
ds = new DataSet("RecoleccionHistoricaDiaria");
da.Fill(ds); and this is the stored procedure:
CREATE PROCEDURE [dbo].[Reportes_RecoleccionHistoricaDiaria]
(
@ID_semana1 int,
@ID_semana2 int
)
AS
BEGIN
DECLARE @Abonos TABLE (ID_semana int, ID_cliente int, Abono int)
INSERT INTO @Abonos
SELECT R.ID_semana, R.ID_cliente, MIN(R.ID_abono)
FROM Recibos R
WHERE R.Estatus = 1 AND R.ID_semana >= @ID_semana1 AND R.ID_semana <= @ID_semana2
GROUP BY R.ID_semana, R.ID_cliente
DECLARE @AbonosPorDia TABLE (ID_semana int, DiaPago int, Pagados int)
INSERT INTO @AbonosPorDia
SELECT OS.ID_semana, Recibos.DiaPago, COUNT(Recibos.ID_recibo) AS Pagados
FROM Operacion_Semanas OS
INNER JOIN Recibos ON OS.ID_semana = Recibos.ID_semana
INNER JOIN @Abonos A ON Recibos.ID_abono = A.Abono
WHERE OS.ID_semana >= @ID_semana1 AND OS.ID_semana <= @ID_semana2
GROUP BY OS.ID_semana, Recibos.DiaPago
ORDER BY OS.ID_semana
SELECT OS.ID_semana, OS.Fecha,
(
SELECT COUNT(ID_recibo)
FROM Recibos
WHERE Extra = 0 AND ID_semana = OS.ID_semana
) AS Emitidos,
(ISNULL(
(SELECT Pagados FROM @AbonosPorDia T
WHERE T.ID_semana = OS.ID_semana AND T.DiaPago = 4
), 0)) AS Jueves,
(ISNULL(
(SELECT Pagados FROM @AbonosPorDia T
WHERE T.ID_semana = OS.ID_semana AND T.DiaPago = 5
), 0)) AS Viernes,
(ISNULL(
(SELECT Pagados FROM @AbonosPorDia T
WHERE T.ID_semana = OS.ID_semana AND T.DiaPago = 6
), 0)) AS Sabado,
(ISNULL(
(SELECT Pagados FROM @AbonosPorDia T
WHERE T.ID_semana = OS.ID_semana AND T.DiaPago = 0
), 0)) AS Domingo,
(ISNULL(
(SELECT Pagados FROM @AbonosPorDia T
WHERE T.ID_semana = OS.ID_semana AND T.DiaPago = 1
), 0)) AS Lunes,
(ISNULL(
(SELECT Pagados FROM @AbonosPorDia T
WHERE T.ID_semana = OS.ID_semana AND T.DiaPago = 2
), 0)) AS Martes,
(ISNULL(
(SELECT Pagados FROM @AbonosPorDia T
WHERE T.ID_semana = OS.ID_semana AND T.DiaPago = 3
), 0)) AS Miercoles
FROM Operacion_Semanas OS
WHERE OS.ID_semana >= @ID_semana1 AND OS.ID_semana <= @ID_semana2
END Basically, I have a table of payments agreed by each customer in table LineasCredito_AbonosPactados which is big and currently contains about 300,000 records. Each week a customer pays one or more receipts (in table Recibos , around 70,000 records), each receipt corresponding to only one payment.
This SP gets how many customers pay each day of the week for weeks starting in @ID_semana1 and ending in @ID_semana2 (each week is a record in Operacion_Semanas ).
How it works? The first temporary table gets all the customers that paid at least one receipt, and the day they paid the first receipt, for each week in the range.
The second table counts the customers in the first table for each day of the week, so it ends up with something like this:
Week Day Count
---------------------
1 0 100
1 1 123
2 0 122
2 1 134 And finally, the recordset returned contains all the weeks in the range with one field for each different colum:
Week Total Day 0 Day 1
----------------------------
1 589 100 123 ....
2 628 122 134 .... This stored procedure works, and relatively well (2 or 3 seconds in very extreme conditions.) But only from SQL Management Studio when called with this code:
EXEC Reportes_RecoleccionHistoricaDiaria
@ID_semana1 = 1,
@ID_semana2 = 100
GO But if I use the code at the beginning of this post to call the SP from my C# application, then it always times out in the extreme condition (all 40 or so weeks) and takes about a minute for a range of 3 weeks. And then I go to SQL Server Management Studio and click on Execute and it takes less than a second... while the C# app is waiting.
Any ideas? this is driving me crazy!
Thanks!
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005
|
|
|
|
|
It suddenly started working on my SQL Server (development) as fast as exepected, but it now is slow again.
I installed the update on the production server (it's for a small business, and they have been told that this particular report will be slow for a while) and it's also very very slow. Running the SP with OSQL is also slow, but not as much as from the application.
Does anyone have any idea of what's going on? I'm going crazy!
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005
-- modified at 21:00 Wednesday 11th January, 2006
|
|
|
|
|
I am so crazy too when discover your problem. Could you send me the database file? (Compress and attach to email or by yousendit).
I try to create the database but I can not insert so much data.
My email address: happyrainy@gmail.com
|
|
|
|
|
Thanks, but late yesterday we found a solution. Basically we changed the code from declaring a table variable to creating a temporary table, and now it's always as "fast" as it should be:
CREATE TABLE #Abonos (ID_semana int, ID_cliente int, Abono int)
INSERT INTO #Abonos
SELECT R.ID_semana, R.ID_cliente, MIN(R.ID_abono)
FROM Recibos R
WHERE R.Estatus = 1 AND R.ID_semana >= @ID_semana1 AND R.ID_semana <= @ID_semana2
GROUP BY R.ID_semana, R.ID_cliente
CREATE TABLE #AbonosPorDia (ID_semana int, DiaPago int, Pagados int)
INSERT INTO #AbonosPorDia
SELECT OS.ID_semana, Recibos.DiaPago, COUNT(Recibos.ID_recibo) AS Pagados
FROM Operacion_Semanas OS
INNER JOIN Recibos ON OS.ID_semana = Recibos.ID_semana
INNER JOIN #Abonos A ON Recibos.ID_abono = A.Abono
WHERE OS.ID_semana >= @ID_semana1 AND OS.ID_semana <= @ID_semana2
GROUP BY OS.ID_semana, Recibos.DiaPago
ORDER BY OS.ID_semana
Thanks anyway for trying to help, I really appreciate it!
-- LuisR
nguyenvhn wrote: My email address: happy#rainy@gmail#com
P.S. I don't recommend posting your e-mail address like this. CodeProject is commonly crawled by spiders looking for e-mail addresses for spam lists. Modify your post to remove it, or at least disguise it:
happyrainy at gmail dot com
happyrainy.gmail@com (swap @ and .)
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005
|
|
|
|
|
I cannot update the Data grid fields for the following example:
The grid and 2 buttons are visable but I cannot mainpulate (update) the data
Imports System.Data.SqlClient
Public Class WebForm1
Inherits System.Web.UI.Page
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<system.diagnostics.debuggerstepthrough()> Private Sub InitializeComponent()
Me.cnPubs = New System.Data.SqlClient.SqlConnection
Me.daAuthors = New System.Data.SqlClient.SqlDataAdapter
Me.SqlSelectCommand1 = New System.Data.SqlClient.SqlCommand
Me.SqlInsertCommand1 = New System.Data.SqlClient.SqlCommand
Me.SqlUpdateCommand1 = New System.Data.SqlClient.SqlCommand
Me.SqlDeleteCommand1 = New System.Data.SqlClient.SqlCommand
Me.dsPubs = New ADO.dsPubs
CType(Me.dsPubs, System.ComponentModel.ISupportInitialize).BeginInit()
'
'cnPubs
'
Me.cnPubs.ConnectionString = "workstation id=DOZER;packet size=4096;integrated security=SSPI;data source=dozer;" & _
"persist security info=False;initial catalog=pubs"
'
'daAuthors
'
Me.daAuthors.DeleteCommand = Me.SqlDeleteCommand1
Me.daAuthors.InsertCommand = Me.SqlInsertCommand1
Me.daAuthors.SelectCommand = Me.SqlSelectCommand1
Me.daAuthors.TableMappings.AddRange(New System.Data.Common.DataTableMapping() {New System.Data.Common.DataTableMapping("Table", "authors", New System.Data.Common.DataColumnMapping() {New System.Data.Common.DataColumnMapping("au_id", "au_id"), New System.Data.Common.DataColumnMapping("au_lname", "au_lname"), New System.Data.Common.DataColumnMapping("au_fname", "au_fname")})})
Me.daAuthors.UpdateCommand = Me.SqlUpdateCommand1
'
'SqlSelectCommand1
'
Me.SqlSelectCommand1.CommandText = "SELECT au_id, au_lname, au_fname FROM authors"
Me.SqlSelectCommand1.Connection = Me.cnPubs
'
'SqlInsertCommand1
'
Me.SqlInsertCommand1.CommandText = "INSERT INTO authors(au_id, au_lname, au_fname) VALUES (@au_id, @au_lname, @au_fna" & _
"me); SELECT au_id, au_lname, au_fname FROM authors WHERE (au_id = @au_id)"
Me.SqlInsertCommand1.Connection = Me.cnPubs
Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@au_id", System.Data.SqlDbType.VarChar, 11, "au_id"))
Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@au_lname", System.Data.SqlDbType.VarChar, 40, "au_lname"))
Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@au_fname", System.Data.SqlDbType.VarChar, 20, "au_fname"))
'
'SqlUpdateCommand1
'
Me.SqlUpdateCommand1.CommandText = "UPDATE authors SET au_id = @au_id, au_lname = @au_lname, au_fname = @au_fname WHE" & _
"RE (au_id = @Original_au_id) AND (au_fname = @Original_au_fname) AND (au_lname =" & _
" @Original_au_lname); SELECT au_id, au_lname, au_fname FROM authors WHERE (au_id" & _
" = @au_id)"
Me.SqlUpdateCommand1.Connection = Me.cnPubs
Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@au_id", System.Data.SqlDbType.VarChar, 11, "au_id"))
Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@au_lname", System.Data.SqlDbType.VarChar, 40, "au_lname"))
Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@au_fname", System.Data.SqlDbType.VarChar, 20, "au_fname"))
Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_au_id", System.Data.SqlDbType.VarChar, 11, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "au_id", System.Data.DataRowVersion.Original, Nothing))
Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_au_fname", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "au_fname", System.Data.DataRowVersion.Original, Nothing))
Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_au_lname", System.Data.SqlDbType.VarChar, 40, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "au_lname", System.Data.DataRowVersion.Original, Nothing))
'
'SqlDeleteCommand1
'
Me.SqlDeleteCommand1.CommandText = "DELETE FROM authors WHERE (au_id = @Original_au_id) AND (au_fname = @Original_au_" & _
"fname) AND (au_lname = @Original_au_lname)"
Me.SqlDeleteCommand1.Connection = Me.cnPubs
Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_au_id", System.Data.SqlDbType.VarChar, 11, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "au_id", System.Data.DataRowVersion.Original, Nothing))
Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_au_fname", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "au_fname", System.Data.DataRowVersion.Original, Nothing))
Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_au_lname", System.Data.SqlDbType.VarChar, 40, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "au_lname", System.Data.DataRowVersion.Original, Nothing))
'
'dsPubs
'
Me.dsPubs.DataSetName = "dsPubs"
Me.dsPubs.Locale = New System.Globalization.CultureInfo("en-US")
CType(Me.dsPubs, System.ComponentModel.ISupportInitialize).EndInit()
End Sub
Protected WithEvents cnPubs As System.Data.SqlClient.SqlConnection
Protected WithEvents daAuthors As System.Data.SqlClient.SqlDataAdapter
Protected WithEvents SqlSelectCommand1 As System.Data.SqlClient.SqlCommand
Protected WithEvents SqlInsertCommand1 As System.Data.SqlClient.SqlCommand
Protected WithEvents SqlUpdateCommand1 As System.Data.SqlClient.SqlCommand
Protected WithEvents SqlDeleteCommand1 As System.Data.SqlClient.SqlCommand
Protected WithEvents dsPubs As ADO.dsPubs
Protected WithEvents DataGrid1 As System.Web.UI.WebControls.DataGrid
Protected WithEvents btnRefresh As System.Web.UI.WebControls.Button
Protected WithEvents btnSave As System.Web.UI.WebControls.Button
'NOTE: The following placeholder declaration is required by the Web Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
dsPubs.Clear()
daAuthors.Fill(dsPubs)
DataGrid1.DataBind()
End Sub
Private Sub btnRefresh_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRefresh.Click
daAuthors.Fill(dsPubs.authors)
End Sub
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
daAuthors.Update(dsPubs.authors)
End Sub
End Class
|
|
|
|
|
Hello all,
I want to get access to some databases which are registered in Windows with ODBC.
I already managed to get the registered database names, files, servers... everything.
What I am now missing is how I could get the table names of those databases??
I can open an OdbcConnection to any of those databases, but I cannot read anything out of them because I dont know the table names which are in those databases.
So, how can I programmatically get the table names of a database where I already have an OdbcConnection successfully established and open?
Thanks for any help.
Best regards,
Bertram Weckmann
|
|
|
|
|
Hi I am having a bit of trouble trying to display my times in 24hr format, at the moment it is displaying the times with am and pm im just wondering if anyone has any ideas of how to do this
Tim
select ID, SUBSTRING(CAST(Date as nVarChar), 13,20) as Date from Session where (SquadId = 5) and CONVERT(smalldatetime, CONVERT(varchar(8), Date, 112)) = '01/10/2006'
|
|
|
|
|
Use CONVERT[^] to convert the date into just a time. For example: CONVERT(varchar(5), Date, 108)
ColinMackay.net
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
|
|
|
|
|