|
Read this article [^]
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
When you catch the exception in your VB code, what does it say?
|
|
|
|
|
i think so you are having time also with date check that and try to also format your date
Best Of Regards,
SOFTDEV
If you have knowledge, let others light their candles at it
|
|
|
|
|
Well.. When you run this transact-sql statement.. probably you face that the datetime auto reformation like '2009-10-01' to CONVERT(DATETIME, '2009-10-01 00:00:00', 102). You should consider this..
Thanks
Md. Marufuzzaman
Don't forget to click [Vote] / [Good Answer] on the post(s) that helped you.
I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.
|
|
|
|
|
I want to connect to my full SQL Server 2008 SP1 on a remote server over the internet using both VS.NET server explorer and MSSQLServer Management, and in both I failed!
I tried all the steps described in http://msdn.microsoft.com/en-us/library/ms345343.aspx[^] but I still cannot even telnet the remote server on the ports (1433 or the one I assigned as in the tutorial: 49172) ... BUT I can ping it and it replies.
I even closed the firewall application (NOD) on the server as I have full administrative remote desktop access to the server, and still no progress. (And I easily can connect to server using remote desktop)
I really need to connect to the server using SQL Server Management.
Thank you all
|
|
|
|
|
I once did this in the late 90s just to see if it could work, it did. I was then berated for connecting directly to the sql server via the internet for a number of security reasons.
That was DECADE ago when the internet was reasonably benign, you need to implement a communcations layer between your SQL server and your client, it is call a WEB SERVICE or WCF. You are then exposing a service to the big bad internet and not your bloody SQL Server.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
check is your server configured for remote connections and is it working locally or not and did you mentioned your dynamic port try this with odbc --> client configurations and assign port number to 1433 and check
Best Of Regards,
SOFTDEV
If you have knowledge, let others light their candles at it
|
|
|
|
|
this code throw exception
hi guys
when i run the next code
it throw an exception
private void button1_Click(object sender, EventArgs e)
{
try
{
SqlConnection cn = new SqlConnection("initial catalog=vvvvvvvvvvv;server=.;integrated security=sspi");
SqlCommand cmd = new SqlCommand("back_up_database", cn);
cmd.CommandType = CommandType.StoredProcedure;
cn.Open();
int i = cmd.ExecuteNonQuery();
cn.Close();
if (i > 0)
{
MessageBox.Show("Your database is backed up");
}
}
catch(Exception ex)
{
MessageBox.Show("Sorry we can not back up your database");
}
}
but when i execute the stored procedure
ALTER proc [dbo].[back_up_database]
as
ALTER DATABASE [vvvvvvvvvvv]
SET OFFLINE
go
BACKUP DATABASE [vvvvvvvvvvv]
TO DISK = 'D:\SQLServerBackups\vvvvvvvvvvv.Bak'
with NO_COMPRESSION
go
ALTER DATABASE [vvvvvvvvvvv]
SET ONLINE
go
it completed successfully
so what is wrong
thanks for your interest
Mohamed El-Wehishy
|
|
|
|
|
Have you looked at the exception?
|
|
|
|
|
i can not understand you man
please explain your words
i want to know why this exception throwed
thanks for help
Mohamed El-Wehishy
|
|
|
|
|
Mohamed El-Wehishy wrote: this exception
what exception?
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
you can see the first message
i wait your response
thanks
Mohamed El-Wehishy
|
|
|
|
|
Your code contains:
catch(Exception ex)
{
MessageBox.Show("Sorry we can not back up your database");
}
which is moronic, the ex variable contains a lot of information, which you should look at by showing it, say with Console.WriteLine(ex.ToString()); and instead you ignore it and then ask the world what is wrong??????????????????????????????????????????????????????????????????
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
comment try and catch and see what message it gives as error or you can write ex.message also to see the exception message
Best Of Regards,
SOFTDEV
If you have knowledge, let others light their candles at it
|
|
|
|
|
Or he could just learn to debug the code by setting a breakpoint.
only two letters away from being an asset
|
|
|
|
|
I'm trying to create a stored procedure in MSSQL Server 2005 that'll perform the following jobs:
1) Create a login.
2) Create an user in TestDB database for the login created in step 1.
3) Assign the role 'db_generaluser' to the user created in step 2.
The login name and password for the login to be created will be supplied from externally through input parameters. If this procedure executes successfully it returns 0 else 1 to the caller through an output parameter.
When I try to compile it, it's prompting the following error messages:
Msg 102, Level 15, State 1, Procedure sp_CreateLogin, Line 23
Incorrect syntax near '@loginname'.
Msg 319, Level 15, State 1, Procedure sp_CreateLogin, Line 23
Incorrect syntax near the keyword 'with'. If this statement is a common table expression or an xmlnamespaces clause, the previous statement must be terminated with a semicolon.
Msg 319, Level 15, State 1, Procedure sp_CreateLogin, Line 27
Incorrect syntax near the keyword 'with'. If this statement is a common table expression or an xmlnamespaces clause, the previous statement must be terminated with a semicolon.
What's my mistake? Plz help. My code follows:
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- ==========================================================================================================
-- Author: Priyamtheone
-- Create date: 2009-Oct-08
-- Description: This procedure is used to create a login, create an user in TestDB database associated to
-- that login and assign the role 'db_generaluser' to that user. The login name and password
-- will be supplied from externally through input parameters. If this procedure executes
-- successfully it returns 0 else 1 to the caller through an output parameter.
-- ==========================================================================================================
CREATE PROCEDURE [dbo].[sp_CreateLogin]
-- Add the parameters for the stored procedure here.
@loginname sysname,
@passwd sysname,
@intRetVal int = 0 output --Output parameter.
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from interfering with SELECT statements.
SET NOCOUNT ON;
SET @intRetVal = 0;
BEGIN TRY
CREATE LOGIN @loginname WITH PASSWORD=@passwd, DEFAULT_DATABASE=[TestDB], DEFAULT_LANGUAGE=[us_english], CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF
CREATE USER @loginname FOR LOGIN @loginname WITH DEFAULT_SCHEMA=[dbo]
EXEC sp_addrolemember N'db_generaluser', @loginname
END TRY
BEGIN CATCH
SET @intRetVal = 1; --Something went wrong. So set the return value to 1.
END CATCH
END
GO
modified on Friday, October 9, 2009 9:02 AM
|
|
|
|
|
hi
i looking for converting tool (better free) for
convert database oracle,sql server and access
from one type to another
thank's in advance
|
|
|
|
|
|
Doesn't Access have a wizard that can export to SQL Server as standard? Doesn't work with Oracle, though, since it's SQL Server-specific.
|
|
|
|
|
hi
i developed a program that will shows the rows for a specific table
for the specific database but this is not end of the store
there is another program that will changes the tables rows
my program has to sense the change immediately and do some thing special
"for example warn the user"
what can i do to sense these changes immediately and notify my program?
thanks in advance
|
|
|
|
|
you did not mention which db are you using in case of Sql Server, triggers can help you out
Best Of Regards,
SOFTDEV
If you have knowledge, let others light their candles at it
|
|
|
|
|
hi dear softdev
i build a database named "Alarms" but this is not important !
please attention !
i want to notify my windows application , not to notify any other objects in sql server!!!! (how can i use triggers to notify an application?)
and both of application and database will run in a local computer
perhaps i have to use "notification service"
but it is hard to implement and distribute it !
is there any other solution ?
pleeeeeeeeeeeeeeaaaaaaaaase help me!
|
|
|
|
|
reza assar wrote: perhaps i have to use "notification service"
That would be the best way, its not difficult if you read up about it. Otherwise all I can suggest is polling for changes
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
Hello,
I have been working with VB ADO for some time using Visual Studio 2003 and created several applications connecting to Excel with ADO. However, I have moved to Visual Studio 2008 now and have run into some trouble with the new DatagridView in the latest .NET version. Let me step through the process.
Upon 'Form_Load', I connect to my database, fill the dataset, bind it to my DataGridView in a different Form named, which is publicly defined and created upon startup. I utilize the DataGridView values to populate several text boxes and richtextboxes based upon the data. This is all working great.
The problem came when I tried to create other controls to manipulate this datagridView. The lines I am using to access this are:
Form2.DataGridView1.Item("ColumnName", CurrentRecordRow).Value()
Whenever I try this same line of code through a different subroutine (a button click for example) I get an index out of array error.
Through some troubleshooting, I have managed to discover that the 'RowCount' property of the DataGridView changes to '0' when outside the Form_load subroutine where I populate the DataGridView from the created dataset. (in the FormLoad, the rowcount is 236, when I click a button that shoots a messagebox with the Rowcount again, it says its 0)
This explains the 'index' fatal error generated, but not why the data seems suddenly 'gone' once the form has loaded?
Can anyone make a recommendation of what I may be doing wrong in accessing the data within this DataGridView?
thanks,
Grollub
modified on Thursday, October 8, 2009 3:35 PM
|
|
|
|
|
1 Excel is NOT a database and should not be used as a database. I recommend that you change to either XML files for VERY small volumes or SQL Server/Express for more robust data storage. Take Excel out of the design.
2 When manipulating the data in a datagridview you work with the underlying data container (datatable probably)
3 Check the CurrentRecordRow using a break point, it is probably not set
|
|
|
|