|
That isn't really an error, although for some reason it seems as though the message table (which contains the format strings for event log entries) wasn't registered properly. Anyway, it's actually an Information class event, and the log message simply means that the SQL Server service is started and is listening for connections using the Shared Memory scheme. You should be able to connect to it on the local machine. To connect to it over the network, you will need to enable at least one network protocol.
|
|
|
|
|
Thanks for all your help guys. I restarted and before I know it..........Walla.........my MSSQL server was up and running. I am really glad to a part of this forum and really grateful for you guys. Thanks.
Greg
Coding makes the world go round!!!
|
|
|
|
|
hi all i have this pro on hand now.. i have downloaded some sample database applications from the internet..however when i want to debug it i gives me the error--An unhandled exception of type "system.Data.OleDb.OledbException" occurred in system.data.dll
does this errors occur due to where the dB file is located..is it correct? can someone out there help will this pro? and maybe guide me to correcting it ..thanks in advance..
an extract on of codes where the problem is highlighted is below:the pro is bold...thanks in advance
private void fclsMain_Load(object sender, System.EventArgs e)
{
m_cnADONewConnection.ConnectionString =
@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\temp\contacts.mdb";
m_daDataAdapter =
new OleDbDataAdapter("Select * From Contacts",m_cnADONewConnection);
OleDbCommandBuilder m_cbCommandBuilder = new OleDbCommandBuilder(m_daDataAdapter);
m_daDataAdapter.Fill(m_dtContacts);
this.ShowCurrentRecord();
one of the ans i got is entering cnADONewConnection.Open();
before m_daDataAdapter.Fill(m_dtContacts);
but i got an error like this C:\Documents and Settings\STUDENT\Desktop\Database Example\Form1.cs(235): The type or namespace name 'cnADONewConnection' could not be found (are you missing a using directive or an assembly reference?)
can anyone please give me more detailed help as im really new to this
|
|
|
|
|
skyeddie wrote: The type or namespace name 'cnADONewConnection' could not be found
Basically the variable / type / class "cnADONewConnection" cannot be found. I'm guessing (based on the snippets you provided), that you'll need to find the line which this error was thrown on (the debugger will break on that line) and rename 'cnADONewConnection' to 'm_cnADONewConnection'.
Try that, I can't provide more information because there aren't enough details (if you have exceptions throw can you please in future provide the majority of the text because it will help much more, i.e. just saying an exception of type 'OleDbException' was thrown, provide the error message, although it may not look like much it will help us help you.
Formula 1 - Short for "F1 Racing" - named after the standard "help" key in Windows, it's a sport where participants desperately search through software help files trying to find actual documentation. It's tedious and somewhat cruel, most matches ending in a draw as no participant is able to find anything helpful. - Shog9
Ed
|
|
|
|
|
I'm just starting to familiarise myself with ADO etc, however I am reasonably familiar with relational databases on non-windows platforms.
I started by creating a SQL database, defining a couple of simple tables and a foriegn key relationship between the two. I dragged the two tables onto the DataSet design surface, and pleased to see the relationship was also manifested.
The problem I have is no matter how hard I try, I just can't get changes (inserts, deletes or updates) made to the DataSet tables to persist in the actual database tables. I've focused on insertions -so far I've tried 1) using table.Rows.Add(row); 2) using adapter.Insert(col1Value, col2Value etc) and 3) invoking a stored procedure directly with a SQLCommand.ExecNonQuery. I can see the rows in the DataSet table, they get pulled into listboxes, datagrids etc. But the values never seem to get to the database itself.
If I put rows into a table directly (from the DataSources window) then they persist in the d/b itself and my code will get them with an adapter.Fill - hence I'm pretty sure that the connection string is OK. Before executing an AcceptChanges (at table or dataset level) HasChanges returns true, HasErrors returns false and the RowStates are as expected, AND after the AcceptChanges HasChanges and HasErrors are false and all the RowStates are Unchanged.
The impression I have is that the database is "readonly", and writes are being ignored and exceptions are not raised.
I'm using VS C# Express and SQLExpress -
Any assist will be truly assisted
|
|
|
|
|
If you dragged & dropped the dataset onto the designer there should have been a TableAdapter component created as well for each of the tables in the dataset. You need to use these to update the server, any changes you make to the dataset are made to a local copy. These table adapters then provide the functionality to update the server from the dataset.
If you take a look at the form's load event handler you'll see that the designer automagically added some code to download the changes. It's up to you where you want to put the code to save the changes, maybe in the Form.Closing event or under a "save" button.
Hint: use the TableAdapter.Update methods.
Formula 1 - Short for "F1 Racing" - named after the standard "help" key in Windows, it's a sport where participants desperately search through software help files trying to find actual documentation. It's tedious and somewhat cruel, most matches ending in a draw as no participant is able to find anything helpful. - Shog9
Ed
|
|
|
|
|
Thanks Ed - I've found the problem
I did not realise that the database from my "source" directory was being copied to the "target" directory by the build process. I think everything I tried actually worked, it was just that I was looking in the wrong place.
I've resolved it by putting pre & post build events in to copy the database in the "target" to "safety" in the prebuild and back again in the postbuild - I tried making the connection string absolute but it did not like that.
I'm not getting any code generation out of the data designer, other than into its blahblah.designer.cs code, the blahblah.cs only contains a partial class for the dataset, when I click on a table or adapter all I get is an error message box the text of which I thought I'd saved but now I cant find, my dev machine is not online at the moment.
I think I might reinstall VS C# as it has been getting a few weird problems of late, it's sort of wearing out or something. I'm sure I've seen the code you mentioned.
Thanks again, rgds phild
|
|
|
|
|
Help!
I recently installed VS 2005, I had VS2003 installed before (VB and C# only), and had no problem with datasets...
Now, in VS 2005, 2hen I create any DataSet, then in the dataset designer, try to add a DataTable, or TableAdapter, Query, anything... I get the following error (relative to the item being added):
Failed to add DataTable.
Exception has been thrown by the target of an invocation.
Any help you can provide would be greatly appreciated!
Thanks,
Gary
|
|
|
|
|
I'm still on VS 2003 at the moment but I seem to remember reading something about having to convert your files from 2003 to 2005 format.
I would have thought VS would do that for you if it was required but it is possible that you have to do it manually somehow.
Just a thought...
Steve
|
|
|
|
|
Hi Steve,
Thanks for the input! It actually doesn't have anything to do with that. I'm not working on any programs that were previously started in .NET 2003. In fact, if I create a whole new project, and add a dataset, it does the exact same things, I get the same error when I try to add a DataTable, etc.
I ran VS' maintenance mode, which reinstalled VS, and it took forever! You know how installing VS is... However, it did not fix the problem.
I guess I'll have to try contacting Microsoft...
|
|
|
|
|
Okay, I've been trying for a couple of hours and I can't seem to get this. No matter what I try I get 0 rows updated.
I have three tables:
1. tblParts
PartNumber
ID
2. tblLegs
AnchorBoltTemplate
PartID
3. tblAnchorTemplate
LegPartNumber
AnchorTemplatePartNumber
Part numbers have a "common name" that is a varchar (Parts.PartNumber), and a "real" ID which is Parts.ID
What I want to do is take the AnchorTemplate.AnchorTemplatePartNumber and put it in Legs.AnchorBoltTemplate
However, both fields in AnchorTemplate are the "common name" and I have to get the real PartID. I think this is part of the problem because my query doesn't know which partID I want.
This is what I have thus far:
declare @temp varchar(16)<br />
update Legs<br />
set AnchorBoltTemplate = @temp<br />
where exists<br />
(<br />
<br />
select parts.id from parts<br />
inner join anchortemplate atm on atm.legpartnumber=parts.partnumber<br />
inner join anchortemplate atm2 on atm2.LegPartNumber = parts.partnumber<br />
inner join legs on legs.partID = parts.ID<br />
where @temp = parts.id<br />
)
Does anyone see what the heck I am doing wrong???
|
|
|
|
|
UPDATE
legs
SET
legs.AnchorBoldTemplate = @temp
FROM
legs
INNER JOIN parts ON parts.ID = legs.parts.ID
INNER JOIN anchorTemplate ON anchorTemplate.legPartNumber = parts.partNumber
WHERE
parts.partID = @temp
Maybe, I don't have Enterprise Manager to test it but this works when written syntactically correct.
A man said to the universe:
"Sir I exist!"
"However," replied the Universe, "The fact has not created in me A sense of obligation."
-- Stephen Crane
|
|
|
|
|
Based on your description, it sounds like you want to do this:
UPDATE tblLegs
SET AnchorBoltTemplate = AnchorTemplatePartNumber
FROM tblAnchorTemplate atm
INNER JOIN tblParts ON atm.LegPartNumber = tblParts.PartNumber
WHERE tblLegs.PartID = tblParts.ID
--EricDV Sig---------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters
|
|
|
|
|
Hi All,
Greetings...i have a doubt...i've to separate date and time in sql table..its displaying both date and time...can any one tell me the query for that...
Thanks in Advance
Babu
|
|
|
|
|
select datepart(year,timestamp) + '/' + datepart(month,timestamp) + "'/' + datepart(day,timestamp) as date,datepart(hour,timestamp) + ':' + datepart(minute,timestamp) + ':' +<br />
datepart(second,timestamp) as time from sometable
Fairly simple using the datepart function.
Be adviced: The result is a string but you can convert it back to a datetime type.
WM.
What about weapons of mass-construction?
|
|
|
|
|
this SQL code takes current date and time of ur PC
select substring(cast(getdate()as varchar),1,11) as datte, <br />
substring(cast(getdate()as varchar),14,8) as ttime
|
|
|
|
|
Thnaks it is useful for me
Regards,
Jayamaruthi.A
|
|
|
|
|
|
select cast(cast(getdate() as int) as datetime) as DateVal,
getdate()-cast(getdate() as int) as TimeVal
|
|
|
|
|
I am trying to issue a command to MS SQL to perform a backup to a disk file, from a VB.NET 2005 program.
The command structure is as follows :-
BACKUP DATABASE Weighbridge TO DISK = 'C:\SQLBackup\MyServerName\MyDatabaseName_20060803_1108.BAK'
My program reports the following error :-
Incorrect syntax near '\'.
My code is as follows :-
<br />
Private Sub IssueBackupCommand(ByVal Server As String, ByVal Database As String, ByVal BackupPath As String)<br />
<br />
Dim sConnectionString As String<br />
Dim sCommand As String<br />
Dim sSql As String<br />
<br />
Dim connection As New System.Data.SqlClient.SqlConnection<br />
Dim command As New System.Data.SqlClient.SqlCommand<br />
<br />
Try<br />
sConnectionString = "Data Source=" & Server & ";Initial Catalog=" & Database & ";Integrated Security=True"<br />
<br />
sCommand = BackupPath & "\" & Database & "_" & Format(Now(), "yyyyMMdd") & "_" & Format(Now(), "HHMM") & ".BAK"<br />
sSql = "BACKUP DATABASE " & Database & " TO DISK = '" & sCommand & "'"<br />
<br />
With connection<br />
.ConnectionString = sConnectionString<br />
.Open()<br />
With command<br />
.Connection = connection<br />
.CommandType = CommandType.Text<br />
.CommandText = sCommand<br />
.ExecuteNonQuery() '<--- Error produced here<br />
End With<br />
.Close()<br />
End With<br />
<br />
Catch ex As System.Exception<br />
MessageBox.Show(ex.Message)<br />
Finally<br />
command.Dispose()<br />
command = Nothing<br />
If connection.State <> ConnectionState.Closed Then connection.Close()<br />
connection.Dispose()<br />
connection = Nothing<br />
End Try<br />
<br />
End Sub
Any help appriciated
Thanks
Steve Jowett
-- modified at 6:53 Thursday 3rd August, 2006
|
|
|
|
|
Is the error issued by the database??
thanks,
SeEa
|
|
|
|
|
The error seems to be issued by SQL Server. When I run a query consisting of :-
BACKUP DATABASE master TO DISK 'C:\master.BAK'
I get the following message returned :-
Msg 102, Level 15, State 1, Line 1<br />
Incorrect syntax near 'C:\master.BAK'.
Steve Jowett
|
|
|
|
|
backslash is an escape character.
Try C:\\master.bak
WM.
What about weapons of mass-construction?
|
|
|
|
|
Tried your suggestion, but still get the same result
Msg 102, Level 15, State 1, Line 1<br />
Incorrect syntax near 'c:\\master.bak'.
Steve Jowett
|
|
|
|
|
I have found the problem. There is a small error in the VB.NET code
.CommandText = sCommand
Should be
.CommandText = sSql
Da Darrrrrrrr
Thanks everyone for your help anyway
Steve Jowett
|
|
|
|