|
yes i think mystified is the best way to describe it but thanks anyway
|
|
|
|
|
Hi Friends,
I need to run a stored procedure to show the results in my crystal report.
I have just sql server and crystal report.
My problem is, I dont want my users to run that procedure manually can any one help me how can i runt that stored prodedure b4 the user runs crystal reports to get result from my Stroed procedure.
Thanks
Naveed Kamboh
-- modified at 7:09 Monday 26th June, 2006
|
|
|
|
|
Naveed Kamboh wrote: I dont want my users to run that procedure manually
Stored procedures are run from within the program code. Users don't just run them. Don't completely understand your question
|
|
|
|
|
I have a stored procedure in SQLServer which inserts new employee records in a table.
Now i want to be able to insert a small image in the table as well, i can add an image if i use a simple ADO recordset but how do i do it in a stored procedure
Any help in any direction will be much appreciated
i could discard StoredProc and use Recordsets to add records but i would really not
You know you're obsessed with computer graphics when you're outside and you look up at the trees and think, "Wow! That's spectacular resolution!"
Only kings, presidents, editors, and people with tapeworms have the right to use the editorial "we."
|
|
|
|
|
Create a parameter of type image . Use the Parameters collection to pass parameters to your stored procedure (you should be using this anyway). The corresponding Parameter object should be of type adLongVarBinary . Set the parameter's Size to the amount of data you intend to pass, then use AppendChunk to set the data.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
hi guys,
i have the following code,
Private Sub btnopendb_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnopendb.Click<br />
<br />
Try<br />
<br />
With OpenFileDialog1<br />
<br />
' Check to ensure that the selected file exists. Dialog box displays a warning otherwise.<br />
<br />
.CheckFileExists = True<br />
<br />
' Check to ensure that the selected path exists. Dialog box displays a warning otherwise.<br />
<br />
.CheckPathExists = True<br />
<br />
' Get or set default extension. Doesn't include the leading ".".<br />
<br />
.DefaultExt = "MDB"<br />
<br />
' Return the file referenced by a link? If False, simply returns the selected link file.<br />
' If True, returns the file linked to the LNK file.<br />
<br />
.DereferenceLinks = True<br />
<br />
.InitialDirectory = "C:\"<br />
<br />
.Filter = "mdb|*.mdb"<br />
<br />
.Multiselect = False<br />
<br />
.RestoreDirectory = True<br />
<br />
'.FilterIndex = 1<br />
<br />
End With<br />
<br />
If OpenFileDialog1.ShowDialog() = Windows.Forms.DialogResult.OK Then<br />
<br />
txtopendb.Text = OpenFileDialog1.FileName<br />
<br />
End If<br />
<br />
Catch exp As Exception<br />
MessageBox.Show(exp.Message, Me.Text)<br />
End Try<br />
<br />
<br />
End Sub<br />
i have a textbox where i give the path of database. when i give the path of database in textbbox, then i need to open the database in dtagrid. how do i do that?
thanks
|
|
|
|
|
Hi,
I am trying to run a CREATE TABLE statment using CDatabase.ExecuteSQL and ODBC connectivitity. This is in Win 98 and I am using Visual C++ 6.0. The SQL is read from a file placed into a buffer and then CDatabase (DBSQL.ExecuteSQL) is called. I have verified that there are no unintended characters in the SQL that is passed to Execute SQL and that the SQL stmt is terminated by a NULL character.
My SQL:
CREATE TABLE AddrBook
(FILE_NAME C (50) NOT NULL
)
The snippet of code I am using to do this is:
try {
nRC = DBSQL.Open(chdatabaseName,FALSE,FALSE,_T("ODBC;"));
}
catch (CDBException* e) {
cout<<"ERROR: "<<e->m_strError<<endl;
cout<<"Return Code is: "<<e->m_nRetCode<<endl;
return(nRC);
}
while (FileSQL.BuildSQLStmt()) {
try {
DBSQL.ExecuteSQL(FileSQL.SQLStmt.textP);
}
catch (CDBException* e) {
cout<<"ERROR: "<<e->m_strError<<endl;
cout<<"Return Code is: "<<e->m_nRetCode<<endl;
return(nRC);
}
The DBSQL.Connect appears to be working ok, that is I get a -1 RC and the catch exception code is not executed but I get a -1 RC and the message "Syntax error in Field Definition when the cach exception code is executed after the call to ExecuteSQL.
I have tried searching through different references for anything that would show me what I am doing wrong but have not found anything. Anyone have any ideas what I am doing wrong? I think there is something wrong with my Syntax but I don't know what is and I think may have looked at the wrong examples in the MSDN library.
Thanks!
|
|
|
|
|
C (50)
Shouldn't that be Char(50) ?
|
|
|
|
|
You are correct, I think the syntax chart I was using was for Visual Fox Pro. Thanks!
|
|
|
|
|
hi
I opened my sql database and I found it to be in suspect mode so I detached it but now I can't Attach it
does anybody know how!! please help
|
|
|
|
|
You can use sp_attach_db or sp_attach_single_file_db .
Or:
CREATE DATABASE [MyDB] ON (FILENAME = 'C:\MyPath\MyDB_Data.MDF') FOR ATTACH
----------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters
|
|
|
|
|
i have combobox that i binding it to the product table in the form load so when i open the combobox i reterive all the products stored in my database so when i want to save order i choose product from combobox not write it because i used the combobox selected value to save the productid in the orders table not the name of the product....
the problem i have currency manger on that form so i use nevigate button to move between orders so i must have to bind the same combobox to order_details table so when i use nevigate buton it dir the correct product name so i must bind this combbox to 2 tables products & order details and i thnik this impossibole so what is the right soulation to my problem
my right paln is when i open the form that combobox have all the products name stord in my database and whan i use nevigate button the combobox dir the name of product name belong to the current row
ma_refay
|
|
|
|
|
i want to generate table from sql script but dont know how to execute the sql script so i m using selected code from script file to generate table.
String strQuery="CREATE TABLE tblServer (ServerName nvarchar(50) NOT NULL,UserId nvarchar(50) NOT NULL,Password nvarchar(50) NOT NULL)";
SqlConnection conn= new SqlConnection(strConn);
conn.Open();
SqlCommand cmd=new SqlCommand(strQuery,conn);
cmd.ExecuteNonQuery();
conn.Close();
but it gives sql exception i dont know why.what i want to do is create table when app starts on sql server. if you tell me technique of executing sql srcipt file or other method
Tasleem Arif
|
|
|
|
|
|
can we generate a trigger for two tables? if so what is the query to generate a trigger for two tables employye table and department table with employee having department no.
laxman
|
|
|
|
|
laxman.m wrote: can we generate a trigger for two tables?
No.
(So far in my knowledge.)
However, one trigger can be defined for more than one event(that is INSERT, UPDATE, DELETE) and similarly, for each event there can be multiple triggers. For details you can consult with the help documentation (Transact-SQL Help) of Query Analyzer tool.
Regards.
_____________________________
Success is not something to wait for, its something to work for.
|
|
|
|
|
I have a Database that is growing and growing. The size is almost 20 Gb, but there are only 5 or 6 Gb used, and the rest is unused. I ran sp_spaceused and checked it. I saw in some forums that I must reindex, but I don't have clustered indexes, and dbcc dbrindex don't help me. I ran shrinkdatabase, but the shrinkdatabes just release the unallocated space, that is 1 Gb...
Can someone help me?
Manolo
|
|
|
|
|
If i'm not wrong, the Database Maintenance Plan can help you. For detailed information and its usage, SQL Query Analyzer's Help "Transact-SQL Help >>Creating and Maintaining Databases >>Database Maintenance Plan Wizard" might be usefull.
Best of Luck.
_____________________________
Success is not something to wait for, its something to work for.
|
|
|
|
|
I will try. Thanks for your help
|
|
|
|
|
Check the individual files. I'd be prepared to bet that your transaction log is huge while the data file is fairly small.
What you need to do is decide how you want to maintain your database. If you want to be able to recover the database to any point in time, including rolling forward transactions to the point of failure when restoring from your last backup, you need SQL Server to maintain everything that's happened in the transaction log: the Full Recovery Model option. If you're doing this, you need to back up the transaction log as well as the database file using the SQL Server backup feature or a third-party backup solution that understands SQL Server properly (not just backing up the files); once the transaction log is backed up SQL Server will mark the backed-up parts of the file as being free and start reusing them rather than growing the file. You'll have to use shrink with the 'move to start of file' option to actually make the file smaller.
Yes, I would have expected a Full Database Backup to also perform this transaction log clearing - that's what Exchange does. SQL Server doesn't.
If you use bulk inserts and don't want every bulk-inserted row to be recorded in the transaction log, instead performing the bulk inserts again after a restore, consider the Bulk Logged Recovery Model option. I'm not sure if it will actually replay a bulk insert operation if the file is still present in the same location during a restore.
If you're just experimenting with something and aren't going to back it up, or the database is simply a replica of something else, or you only want to restore the last full backup and don't care about transactions that have occurred since, consider the Simple recovery model. SQL Server then still writes to the transaction log - it uses it to recover the state of the database in the case of a power outage or a software failure - but marks the space taken by the log records as free as soon as the transaction that created them commits. It can then reuse them very quickly, keeping the size of the transaction log down.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
The problem isn't with the size of the log file. Look, the sizes of the files are:
stadata.mdf 20,351,680 KB
stadata_log.ldf 4,224 KB
The problem is the quantity of space tha SQL reserves for its grow. When I check the space used (sp_spaceused), the results are:
reserved data index_size unused
------------------ ------------------ ------------------ ------------------
17862602 KB 4216416 KB 4368184 KB 9278002 KB
I found one solution:
1.- Run shrinkdatabase (moving pages to the begining of the file)
2.- Full backup
3.- Delete DB
4.- Restore Database
5.- Shrinkdatabase again (moving pages to the begining of the file)
When I did these steps, The size decreases to 16 Gb, I repeat the steps, and the files decreases to 13 GB, again and 10 Gb and again and 8 Gb, and I stop,
and the unused space is 270,800 Kb.
Now I will use maintanence plain to avoid the DB grow again
Thanks for your help
Manuel
|
|
|
|
|
This is the error I get when I try to update. Some extra information I didn't include when I posted about this a while back is that I've got 2 forms, a main form with a dataset(this is mostly a "view" of what is returned by what the user clicks, no edit features), and I've got a simple edit form that lets the user change stuff in the table they want to edit. Each form uses its own dataset, but I've tried it with a shared dataset. If I make the 2nd form in its own project and run it as a stand alone to edit the table, it works just fine.
******************************************************************************
The query processor could not produce a query plan from the optimizer because a query cannot update a text, ntext, or image column and a clustering key at the same time.
******************************************************************************
Sample code that causes this error.
private void button1_Click(object sender, EventArgs e)
{
this.Validate();
this.tb.EndEdit();
this.tb.Update(this.DataSet.tb);
}
Form was created by using the drag and drop abilities of the data source. simple form, only 4 items in the table.
|
|
|
|
|
I don't think that there is a problem with the C# code that you've posted. From the error message, it sounds like it is the way you have set up your table that is the culprit. The call to Update will cause an update to the table which causes the error message you cited - not because of the Update call, but because of the columns and setup of the table you update.
I have not read the previous post you mentioned, but could you post some information about the way you have setup your table?
Sincerely,
Alexander Wiseman
|
|
|
|
|
The other post was the same, with less information and I posted it on the C# forum. As far as the table is concerned,
ID, Name, Notes
PK INT, Char[10], Char[50]
No Null, Nulls, Nulls
No foreign keys, but another table does use ID as an FK.
Also, I click the buttons on the BindingNavigator for New, and Delete and they work fine, I just can't make a change to the current record displayed and click the save button.
I've made both forms (stand alone project, and the edit form for the parent application) identically, same datasets, same connection strings. All code on both forms is auto generated by the IDE. For some reason, the standalone works fine, but this one doesn't.
|
|
|
|
|
It sounds more like the problem is in Visual Studio's auto-generated code. I am not familiar with this error, but I did a few Google searches and here is what I came up with:
First, on a Weblog I found a post concerning this issue, the solution to which was to remove the default "Create as CLUSTERED" option on the database. You can view that solution here[^]. This does not sound like your problem, since you said it works if you create the application as its own form, meaning that the problem is probably not so much with the table structure as with Visual Studio's code generation.
Concerning that: second, I found this thread which suggests deleting and recreating the data-adapter as a solution to the problem. You can see that here[^].
I hope one of these links gets you going in the right direction. I apologize that I have not been able to be of more assistance.
Sincerely,
Alexander Wiseman
[EDIT]
For the second link, see post number 3 on the page - that is the one to which I was referring.
[/EDIT]
|
|
|
|