Manual SQl Dont Work Correctly
Nov 10, 2007
Hello All Prg's
I need your help,
I use Database SQL server Express with C#
when I entred some data into DB by clciking on the table in server Explorer in Visual Studio 2005 IDE,
and then I make SQL in the code
as:
if (e.KeyCode == Keys.Return)
{
bool res;
int OldPlayerId = 0;
string ConnectionStr = Program.Member_Connect;
string sqlQuery = "select Player_ID from Player where Player_Code = '" + textBox1.Text + "'";
SqlConnection Sql_connection = new SqlConnection(ConnectionStr);
Sql_connection.Open();
SqlCommand command = new SqlCommand(sqlQuery, Sql_connection);
SqlDataReader dataReader = command.ExecuteReader();
if (dataReader.HasRows)
{
if (dataReader.Read())
OldPlayerId = dataReader.GetInt32(0);
else
MessageBox.Show("rtet");
}
else
{
res = false;
}
comboBox2.SelectedValue = textBox1.Text;
command.Dispose();
Sql_connection.Close();
Sql_connection.Dispose();
comboBox1.SelectedValue = OldPlayerId;
}
it work correctly on the old data that I entred them manualy, but when I enter new data from my project, this query don't give correct value, it still work correctly on old data,
I tried to take same data by combobox connected to view that contain same sql ,it work always.
but I need manualy Sql.
Please help me , I am very lating to delever my project...
please help me
thank you very mush
View 13 Replies
ADVERTISEMENT
Jul 20, 2005
I am doing a complete backup on a sql 7 db and then doing a completerestore (with overwrite existing db) on a sql 2000 server. This is nowour hot standby server. I have the process automated and it worksgreat. The only problem I have now is the logins dont work.I have tried running EXEC sp_change_users_login 'Report', and thelogins appear.However, when I run EXEC sp_helplogins 'joe', the results are empty.So, I am guessing all I need is a sp that will re-associate my loginswith the correct db and grant the appropriate permissions.If anyone has any ideas that would be great.I have also considered doing a log ship instead of a full backup andrestore. Does anyone have any suggections or good examples of how tomake that happen?Thanx
View 1 Replies
View Related
Mar 14, 2006
Does anybody know how to work with two (or more) databases in SQL Server 2005; or where that information can be obtained? I searched online, in BOL and asked in this forum but with no success.
information in this posting does not work; results in invalid object name (source database) and/or database does not exist (destination database) errors:
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=292125&SiteID=1
this post about the database does not exist has received no replies:
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=295742&SiteID=1
Of course, both databases exist and their names are valid. Both can be accessed individually thru SSMS and a VB app I am coding. The problem is when trying to work with both of them.
Any information on the subject of working with multiple datatabases and/or links to said subject would be appreciated.
View 12 Replies
View Related
May 24, 2004
I want to optimize a query for fast retrieval of the first row
and after the rest of them automatically.
I used the hint OPTION (FAST 1) but I don't get the hoped results, any idea?
Thanks.
View 5 Replies
View Related
Oct 22, 2007
I have the following query in an ExecuteSQL Task:
Insert Into Table2
Select * From Table1 Where Column1Val = '4'
As you can see, I don't need any parameters so I havent configured any. Also, there should not be any result set so I shouldnt need to configure a resultset parameter.
Why is the above query failing with
Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly
View 4 Replies
View Related
Oct 2, 2007
update [order]
set Status = 'Open'
from (select [order].OrderId from CRM_Order [order]
inner join crm_orderproduct Oproduct on Oproduct.OrderId=[order].OrderId
group By [order].OrderId
having count(Oproduct.OrderProductId)=0 )
I m trying to update the Order <Table> Field Status, where order products count is zero. The Select statement lonely working fine but in update statement getting error.
Msg 102, Level 15, State 1, Line 6
Incorrect syntax near ')'.
View 4 Replies
View Related
Oct 16, 2006
Hi There
Message ordering is of utmost importance in our application.
As i found in testing the only way to ensure message ordering is if they are in the same conversation.If you send multiple messages in different conversations there is no garantee which will be processed first.
Therefore i will be creating conversations that last "forever", that is using a single conversation.
I plan on doing a BEGIN DIALOG CONVERSATION when an inititator site is setup and writing the conversation handle guid to a table.
I will them simply SEND ON SONVERSATION using the guid, i will never issue a end conversation from target or initiator.
Is this theory solid, ie: is there a better way or best practice to do this?
I know that conversatons persist with sql server restarts, however what happens if an initiator site db is restored ?
I was thinking of adding logic to first check if a conversation endpoint exists with the specified guid if not , then start another conversation. But is this the best way?
Thanx
View 2 Replies
View Related
Jul 28, 2007
hi there, i have a invoice template that when printed has a box for the users address (which there always will be) and a box for their delivery address if they are having the items delivered. However sometimes they dont have things delivered and so the record in the delivery table does not exist. In this case it will throw an error, how can i avoid this. the code im using i have posted below string sql = "SELECT [del_address], [del_post_code], [del_date], [del_time] From tbl_del WHERE order_ID = " + intOrderID;
//This creates a sql command which executes the sql statement.SqlCommand sqlCmd = new SqlCommand(sql, myConn);
myConn.Open();SqlDataReader dr = sqlCmd.ExecuteReader();
//This reads the first result from the sqlReader
dr.Read();
try
{
//string strDel_Address = dr["del_address"].ToString();
if (Convert.ToString(dr["del_charge"].ToString()) != null)
{
//delivery items lblDelAddy.Text = dr["del_address"].ToString();
lblDelPCode.Text = dr["del_post_code"].ToString();
View 3 Replies
View Related
Jul 18, 2007
Hi All,Just wondered if i could ask you for some advice and help.I'm looking to write a site, and one of the functions of the site is to remind the user of a certain event at a certain time. I was wondering how i would do this? or if anyone has a working example i could use?Also I dont quite know what database to use...... would MySQL do the function i am after???? If so then no more problem lol If not what database would you recommend i use?ThanksDanny
View 4 Replies
View Related
Aug 10, 2006
Hi all, can anyone explain to me why i am getting this error:
Cannot insert the value NULL into column 'WORKPATTERN_END', table 'MockDownload_V52.dbo.EMPLOYEE_WORKPATTERN'; column does not allow nulls. INSERT fails.
The code i am using is:
DELETE EMPLOYEE_WORKPATTERN
INSERT INTO EMPLOYEE_WORKPATTERN(
EMPLOY_REF)
SELECT CAST(EMPLOY_REF AS VARCHAR(10))
FROM EMPLOYEE
View 10 Replies
View Related
Nov 14, 2006
Hi Friends,
is it possible to find a table in which database it is?
ex: i have one table name rider. i've created it in one database, but i dont know in which database it is.but i know the server name.
is it possible to find like this?
thank you very much.
Vinod
View 9 Replies
View Related
Nov 7, 2007
Hi.I have a update query:
UPDATE test1
SET testprice= ((unitprice*8)/100) + unitprice
it's good.but I dont want to change the testprice if the unitprice is NULL.what should I do?
View 2 Replies
View Related
Dec 10, 2007
Hi!
I've one table named mytable. I dont want to drop and delete
this table? How can i achieve this ?
Please help me out!
Thanks!
View 9 Replies
View Related
Jul 5, 2007
Hi
I have a very smal question that im doing with the query builder in visual studio .net 2005.
there i have this sql question
SELECT tblObjekt.ObjektArkivID, tblObjekt.KundID, tblObjekt.KundensArkivNummer, tblObjekt.HuvudTitel, tbl_Spar.SparID
FROM tblObjekt INNER JOIN
tbl_Spar ON tblObjekt.ObjektArkivID = tbl_Spar.ObjektArkivID.
The problem i have is that it only finds 9 of 11 rows in the database. I thought that maybe some field were "null" but every field has some text in it.
The query must work since it finds 9 items, but 2 are missing.
Someone that knows what can be wrong?
Best regards / Mitmit
View 2 Replies
View Related
Jan 2, 2008
Hi.
I have a table with Login and Logoff Time of users, but there could be duplicate Logtimes in the dataset, but for
different products. Because of this I cant do a distinct in the dataset. I need the Product and some other details in my Report.
I tried to make two datasets. One for the Select distinct and one for the other.
But the Problem is:
in my report, I need a table, where I make the Sum of the Logintime a day and in another column I calculate with data from the other dataset.(Logtime + data from dataset2). But this doesnt work, so I think, that is it not possible to join 2 dataset in one table.
datetime Login | datetime Logout | Product
11.12.2007 10:15 | 11.12.2007 12:15 | p1
11.12.2007 10:15 | 11.12.2007 12:15 | p2
11.12.2007 12:19 | 11.12.2007 15:15 | p2
Is there another option I can do this?
View 4 Replies
View Related
Apr 25, 2008
i have 2 server, Database Server and Application Server.
i create a stored prosedure in Database SERVER (sql 2005)
i call this stored prosedure from my application but , my application dont see my stored prosedure..
what is a problem ? this is working my local computer and database.
my stored prosedure : sp_MyStoredProsedure
application :
...........Using myConnection As New SqlConnection(Config.ConnectionString)Dim myCommand As SqlCommand = New SqlCommand("sp_MyStoredProsedure", myConnection)
myCommand.CommandType = CommandType.StoredProcedure
......
i think Ado.net permission problem but i dont know what is problem
thx.
View 6 Replies
View Related
May 12, 2006
t1
item
partner
t2
item
partner
fname
store
i like select item and partern from t1 that dont exist in t2
View 1 Replies
View Related
Jul 23, 2005
Im trying to recover my database using the mdf and ldf files.I dont have any backup and i have recovered two of the mdf files usinga tool which "discovers" deleted files after hard drive formatting...It sounds cool, isnt it...:? :(Obviously, i get a "suspect" message when the server starts and the logfile says this kind of things:ˇ"Full PathName.MDF is not a primary database file." (This is one ofthe files repaired using the magic tool.ˇError: 823, Severity: 24, State: 6ˇ"I/O error (torn page) detected during read at offset0000000000000000 in file 'Full PathiName2.mdf'... Name2.mdf is thesecond fileˇDevice activation error. The physical file name 'Full PathName2.mdf'may be incorrect.When i try to execute the command "DBCC CHECKDB ('Database_Name') WITHPHYSICAL_ONLY" i get the following message :ˇCould not open FCB for invalid file ID 0 in database 'Logs'.Do you have any ideas? Thank you very much...:D
View 2 Replies
View Related
Aug 30, 2002
We are using an MSDE database engine (1.0=sql7) as a report scheduler on a web server. I can access MSDE via SQL7 Enterprise Manager to connect and view MSDE, but cannot use the DTS and job scheduling as MSDE seems to lack needed components. Using Microsoft Knowledge Base article Q241397 as a guide, I was able to create a backup of the msdb database using stored procedures including sp_add_job, sp_add_jobserver,etc, that are already present in the msdb database.
My problem is that I need to create and schedule a job for another MSDE database called CE8. This database was created by the reporting app, and contains no stored procedures. It looks to me like only msdb has the needed job scheduling procs. Does this imply that I am supposed to schedule all jobs for all databases via msdb database, or will I need to copy all job scheduling stored procedures into the other CE8 database, then create a job? Hope this makes sense,
Randy
View 1 Replies
View Related
Jun 12, 2008
I have inherited a deployment running inside a custom .net application. I'm looking to deploy an updated version of a report to the report server. My question is there a manual way of deploying an RDL? I'm afraid of taking down the application entirely and I do not have detailed enough documentation to bring it back up. Thanks!
View 5 Replies
View Related
Jul 20, 2005
Interested in creating a manual standby database.Will like toimplement this with Sql Server standard Edition availableAny ideas or recommendationsThanksTY
View 1 Replies
View Related
Apr 20, 2007
I m using sql server 2005
i have got one request ,to apply page level locking on database
can nyone how it is done
i can do that for a single script and for session(transaction isolation level)
but dont know about database level locking scheme
thanks in advance
View 2 Replies
View Related
Sep 15, 2005
I do weekly full backups of my SQL databases via a scheduled T-SQL job.I noticed that I have some static databases that dont normally change,so I dont want to back it up if it has not changed, but when it does,then I want a backup.Is there something in the master table, as example, that I can checkprior to running the backup that will indicate any changes?An example is the Northwind database. I could exclude it from thebackup, but then I would not back it up if it where to change. Againthis is an example, I would not need to modify Northwind.Thanks in advance for any ideas; they usually give me ideas to problemsyet to come....Rob Camarda
View 3 Replies
View Related
Apr 27, 2007
Assuming that I have a table [users] in a MSSQL 2005 database. the table has two columns. [userId] and [password].
I have an aspx with C# page with two textboxes and a button.
I want to let the user login or send him an error message if the password or the username does not match from the table in database.
I always made this possible through the template database from administrating the website. but never tried to do it as simple as that. I'm lost here!
How can I do it?
View 3 Replies
View Related
Mar 20, 2001
In SQL 7.0 jobs that have been scheduled start correctly, but jobs will not start when requested manually. All services are running.
The only way to fix this problem has been to reboot the server.
Does anybody have any ideas what might be causing this situation.
TIA,
Philip
View 5 Replies
View Related
Mar 30, 2001
Is there any difference starting a DTS package manually or running as a scheduled task.
There is a DTS package that I start manually from my PC and runs for 40 minutes and during this time I cannot access Enterprise Manager.
View 2 Replies
View Related
Nov 28, 2007
I would like to automate a simple process which involves trucating a table and importing records back in. What would be the simplest solution to automate this kind of process? I'd like to run this process twice a day.
Thanks!
View 4 Replies
View Related
Oct 30, 2007
Hi,
I have only ever created and deployed SQL 2005 Reports to the report server using Business Intelligence Studio. I have a client who's network will not allow me to remote connect to their Reporting server so that I can deploy their reports.
If I deploy the reports to my own report server, how can I then manually upload them to the Report Server using their Report Manager instad of my Business Intelligence Studio. The Upload files option is only looking for 1 file at a time, however the Business Intelligence solution have the files split up instead of in one neat package.
Cheers
Jason
View 4 Replies
View Related
Sep 14, 2006
I never had to use DTS in MSSQL 2000 but I'm finding a need to use SSIS quite a bit in a new position. I know this is subjective, but I looking for suggestions for a reference book with good examples and tutorials.
TIA
View 3 Replies
View Related
Jan 30, 2008
I recently built a SQL Server x64 server, where I changed the default install path of SSIS. My reason for doing so was to move the SSIS engine off of the system volume, onto a different set of spindles, to reduce potential contention between the OS, the SQL Engine and the SSIS Engine. It is also documented in BOL as an option for the components.
The 64-bit runtime installed fine on the new volume, however, the 32-bit runtime was not installed at all. I checked Program Files (x86) and the directories I chose during the initial install, but only the 64-but runtime exists on the server. Since 64-bit drivers are limited (to put it mildly), I would say about half of the packages I run through jobs require execution of the 32-bit runtime to work.
BOL doesn't seem to indicate that the 32-bit will not install if the default is changed, but the following note indicates that I would not even be able to uninstall/reinstall the components back to the system drives:
A single installation path is shared between SQL Server Integration Services, Notification Services, and Client Components. Changing the installation path for one component also changes it for other components. Subsequent installations install components to the same location as the original installation.
I am wondering if there is a command-line install option to ensure the 32-bit runtime is installed, or if there is a way to install the 32-bit SSIS runtime manually. And if not, can the registry be edited to force a re-install back to the default path?
Any ideas?
View 4 Replies
View Related
Jan 16, 2007
I'm trying to install SQL2005 Express Edition, the adv. version that includes SSRS. The installation fails because it cannot upgrade the existing SSRS2000. I tried to uninstall the latter from the Add/Rem. Programs, and I get "Fatal Error during installation". IIS was stopped prior to the uninstall attempt.
SSRS2000 will thus not uninstall. How can I do a manual uninstall of it? I need to retain my SQL2000 instance, so the manual uninstall of SSRS must not injure it.
View 4 Replies
View Related
Feb 6, 2003
Hi,
Im having a couple of problems with SQL.
I have this query...
SELECT Band.Name, Member.Name
FROM Member
JOIN MemberOf ON Member.Mid = MemberOf.Mid
JOIN Band On MemberOf.Bid = Band.Bid
WHERE MemberOf.Instrument = 'keyboards';
which basically shows me the name of the bands who had keyboard players. I would like it to also display the names of the band who didnt have keyboard players, replacing the keyboard players name with "NULL".
so... my questions are :)
how do u get it to display the records that do not match the condition, and how do u get it to replace the keyboard players name with "NULL" when they do not match the condition.
PS. The three tables are
Band. Which has Bid as a primary key.
Member. Which has Mid as a primary key.
MemberOf. Which links these through its two foreign keys Mid and Bid.
Thanks for your help! (assuming someone does)
View 2 Replies
View Related
Apr 5, 2008
I have a stored procedure in which at the bottom of the code, im granting execute permissions to a role I have defined. However, when I view the permissions on the procedure, the role isnt there, what could I be missing ? The procedures were all created under the default or dbo schema. I could manually give the permissions to the role, but id rather have it scripted.
help ?
View 5 Replies
View Related