There is a field which I'm doing a sUM() on to get a total for a QtyRecieved from one of the tbls in the SP.. However, the QtyRecieved field is set to be a two decimal place numeric field.
The sp works fine without issues until on the of the qty received is not a round number.
If it's a number with a decimal in it (i.e 5.5) then this is show as a seperate result and not SUM'd with the others.
Any ideas why?
SELECT PDS_Login.Supplier_Products.ProductName, PDS_Login.Supplier_Products.ProductCode, dbo.Suppliers_POs_Details.POID, dbo.Suppliers_POs_Details.PODetailsID, dbo.Suppliers_POs_Details.Qty, dbo.Suppliers_POs_Details.PricePerItem, dbo.Suppliers_POs_Details.PoDetailsStatus, dbo.Suppliers_POs_Details.PoDateExpected, dbo.Suppliers_POs_Details.PODateReceived, PDS_Login.Supplier_Products.UOM, PDS_Login.Supplier_Products.Vatable, dbo.Suppliers_POs_Details.ProductID, dbo.Suppliers_POs_Details.PODetailsStatusReason, SUM(dbo.Suppliers_POs_Details_Received.Qty) AS QtyReceived FROM PDS_Login.Supplier_Products INNER JOIN dbo.Suppliers_POs_Details ON PDS_Login.Supplier_Products.ProductID = dbo.Suppliers_POs_Details.ProductID RIGHT OUTER JOIN dbo.Suppliers_POs_Details_Received ON dbo.Suppliers_POs_Details.PODetailsID = dbo.Suppliers_POs_Details_Received.PODetailsID GROUP BY dbo.Suppliers_POs_Details.PODetailsID, dbo.Suppliers_POs_Details.Qty, PDS_Login.Supplier_Products.ProductName, PDS_Login.Supplier_Products.ProductCode, dbo.Suppliers_POs_Details.POID, dbo.Suppliers_POs_Details.PricePerItem, dbo.Suppliers_POs_Details.PoDetailsStatus, dbo.Suppliers_POs_Details.PoDateExpected, dbo.Suppliers_POs_Details.PODateReceived, PDS_Login.Supplier_Products.UOM, PDS_Login.Supplier_Products.Vatable, dbo.Suppliers_POs_Details.ProductID, dbo.Suppliers_POs_Details.PODetailsStatusReason, dbo.Suppliers_POs_Details_Received.Qty HAVING (dbo.Suppliers_POs_Details.POID = @POID)
I've recently just got started using sub queries. The sub query that I'm running is supposed to select distinct values out of a table. It doesn't seem to be working though.
SELECT id FROM data WHERE (issueID IN (SELECT DISTINCT issueID FROM data))
When I execute this query, it returns a list of id's, but they don't each have a unique issueID. In the data table, issueID can appear more than once (hence, I need to use distinct). However, id is the primary key, and is unique.
In a stored procedure the following code snippet 1 checks against duplicate data being inserted. I've tested it with snippet 2 and it works as expected. However, when the procedure is called from ASP.NET the check seems ineffective. I still get the error msg. The application uses a SqlDataSource with the following parameters.
Any suggestions?
Thanks,
Bakis.
PS I want to ask a question on the ASP.NET forum .The login/pwd for this forum "get me in" to the .net forum in the sense that when I log in I see a logout link. I don't get an "ask a question" button though. Is there a separate screening for each forum?
<UpdateParameters>
<asp:Parameter Name="CatItemUID" Type="Int32" />
<asp:Parameter Name="CatName" Type="String" />
<asp:Parameter Name="Item" Type="String" />
<asp:Parameter Name="Quad" Type="Int16" />
<asp:Parameter Name="UID" Type="Int64" />
</UpdateParameters>
snippet 1 :
if (@CatItemComboExists > 0 ) BEGIN --print @CatItemComboExists return 0 END
snippet 2:
begin tran declare @return_status int EXECUTE @return_status = spUpdateCatItemRec 343, 'blah','blih', 2,3 print @return_status rollback
error msg only if proc is called from app
Violation of UNIQUE KEY constraint 'IX_tblCatItemUID'. Cannot insert duplicate key in object 'tblCatItemUID'.
Ok.. I have a web site I am developing in Visual Studio 2005. Its VB based with SQL Server 2005 as the backend. IIS 6 is the web engine and all of this is running on a Windows 2003 Server.
Here is the problem.. I have a form that authenticates a user and then redirects them to another page. The redirection is not working. All I get is 'Your login attempt was not successful. Please try again.' So I decided to trouble shoot a little and I added a Forgot your password control and a Sign up for new account control to the page as well. When I do the Forgot my password it sends me the username and password in an email, but it just refuses to accept them.
If I use the sign up for a new account control it actually lets me into the redirect page but if I log out and try to get back in it fails. Its crazy and if driving me out of my mind.
If someone wants to help me out I would appreciate it. I have been racking my brain over this for too many days.
Thanks in advance...
Mark
Ps. - I have read every thread and tried just about everything regarding this issue. It has to be something stupid and simple that I am overlooking.
I'm trying to run the following SQL against my ntext column, Testtbl.Task I want to replace where the ampersand sign got HTML encoded to "&", and I want to strip it down to only the ampersand sign and deletethe "amp" and the ";".It executes, but I still have the HTML encoding for the ampersand sign if the issue is NOT the first character in the ntext column. If it's the first part of the ntext column, then it works.
I have a problem with a conditional format of the Color property in a matrix report. When the value of the textbox is greater than 0, the color should be Red otherwise it should be Blue. This is implemented via an IIF statement and works perfectly in Preview in Visual Studio 2005.
When the report is deployed, the formatting appears to be ignored and all values are the default value of Black.
Anyone else experienced this problem and, if so, is there a workaround?
VS 2008. I have the following set up. Group1, Group2, Group3 header, Group 3 detail rows..When I set the row visibility (hide based on Group2) on the Detail row, it still shows up when the report is originally rendered.
It should be: Group1 expanded, Group2 collapsed, Group3 header hidden and detail rows hidden It is showing: Group1 expanded, Group2 collapsed, Group3 header hidden, Group3 detail row visible.
I never had this trouble in 2005. Is there something different about row visibility in 2008?
fetch next from emailCursor into @Name,@info, @Recipients,@MyMessage
end close emailCursor deallocate emailCursor
Currently I have two users in my table that I want to send email to, but when the stored procedure runs I got two emails for the last user in the table instead one for each user.
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
I had a view in which I did something like this isnull(fld,val) as 'alias'
when I assign a value to this in the client (vb 6.0) it works ok in sql2000 but fails in 2005. When I change the query to fld as 'alias' then it works ok in sql 2005 . why ?? I still have sql 2000 (8.0) compatability.
Also some queries which are pretty badly written run on sql 2000 but dont run at all in sql 2005 ???
any clues or answers ?? it is some configuration issue ?
I'm trying to use the bcp utility to transfer data from an SQL Server table (CUSTOMERS) to a text file (test.txt).
Here is what I have: DECLARE @FileName varchar(50) SET @FileName = 'C: est.txt'
EXEC bcp BAirwaysDB..CUSTOMERS out @FileName -S<servername> -T
only I keep getting the error: Msg 102, Level 15, State 1, Line 4 Incorrect syntax near '.'.
and when running: bcp BAirwaysDB..CUSTOMERS out C: est.txt -S<servername> -T
on the command line I get: SQLState = 28000, NativeError = 18456 Error = [Microsoft][SQL Native Client][SQL Server]Login failed for user 'RIVERAMelanie'. SQLState = 42000, NativeError = 4060 Error = [Microsoft][SQL Native Client][SQL Server]Cannot open database "BAirways" requested by the login. The login failed.
Can you see where I'm going wrong with this? Any feedback would be really appreciated.
This is a subset question of one of my other threads, the gist is while using forms authentication, I am trying to enter additional information into another table on the same db as the aspnet_membership tables. I think I need an <asp:SqlDataSource> to do this because it is about the only thing left I haven't tried to get this code to work so any help is appreciated. Environment: sql server 2000, windows server 2003, asp.net 2.0, vb, no GUI<ASP:SqlDataSource id="addedInfo" ConnectionString="<%$ ConnectionStrings:SqlServerConnection %>" InsertCommand="INSERT INTO addInfo(username,email,company,firstname,lastname,phone) VALUES (@username,@email,@company,@firstname,@lastname,@phone)" runat="server" />looking over some of my books and online it says in the connectionStrings that it is supposed to be the database name that goes next to the : but when I try that I get an error that it is looking for the name of the connection string, so I enter the name of the connection string (as above) and nothing happens, which is basically the ongoing event with this whole problem, the form fields (username, email, password) that go into the aspnet_membership tables just fine, I don't have any problems with those, it is getting the additional information into another table that has been stalling me the whole time.So does this sqldatasource look right? Any help is appreciated.
Call me an idiot as I'm quite new to asp.net. I'm working through a book called 'ASP.NET Unleashed' where the chapter on how to create a database connection to an sql database on MSDE called 'pubs' is shown. Iv'e installed MSDE. When I try to run the example it says that the login or authentication has failed. Iv'e tried different things but I'm out of ideas. Another thing is that when I try to install sql server 2000 on my Win XP it first says something about this being the wrong OS or something like that. I can get past that but when I'm presented with 3 installation options 1.client 2. client and connectivity 3.connectivity I installed client because that's supposed to create a stand alone installation. However when I'm done installing the only new entry in the start->programs is client connectivity. Where is the Enterprise services that I'm supposed to be able to access according to the book? Is sql server 2000 compatible with XP and not just win 2000?
can somebody tell me whats wrong with this sp..................when i pass lname only or fname only it does not return any data, but when i passs both lname and fname it returns the correct data.....when i rearrange the structure to where it checks the lname only it works also but fname doesn't .........any help is greatlly appreciated
CREATE PROCEDURE [dbo].[temp_search] ( @lname varchar(50) = null, @fname varchar(50) = null, @date1 datetime = null, @date2 datetime = null) /*set @lname = null -- 'aaa'set @fname = null --'ddd'set @date1 = '2/25/2003'set @date2 = '9/30/2004'*/ as set nocount on if not @lname is null or @lname = '' and not @fname is null or @fname = ''begin select temp_user_info.*, dateTime1 FROM temp_user_info INNER JOIN temp_seq ON temp_user_info.temp_seq = temp_seq.temp_seq WHERE temp_user_info.temp_seq = temp_seq.temp_seq and temp_user_info.lname like @lname and temp_user_info.fname like @fnameendelse if not @lname is null or @lname = '' begin select temp_user_info.*, dateTime1 FROM temp_user_info INNER JOIN temp_seq ON cir_temp_user_info.temp_seq = temp_seq.temp_seq WHERE temp_user_info.temp_seq = temp_seq.temp_seq and temp_user_info.lname like @lname end else if not @fname is null or @fname = '' begin select temp_user_info.*, dateTime1 FROM temp_user_info INNER JOIN temp_seq ON temp_user_info.temp_seq = temp_seq.temp_seq WHERE temp_user_info.temp_seq = temp_seq.temp_seq and temp_user_info.fname like @fname end else if not @date1 = null and not @date2 = null begin select cir_temp_user_info.*, dateTime1 FROM cir_temp_user_info INNER JOIN temp_seq ON cir_temp_user_info.temp_seq = temp_seq.temp_seq WHERE temp_user_info.temp_seq = temp_seq.temp_seq and dateTime1 between @date1 and @date2 end else if not @date1 = null begin select temp_user_info.*, dateTime1 FROM temp_user_info INNER JOIN temp_seq ON temp_user_info.temp_seq = cir_temp_seq.temp_seq WHERE temp_user_info.temp_seq = temp_seq.temp_seq and dateTime1 like @date1 endGO
I am very new to SQL server and I'm using stored procedures for my program. So far I wrote one tonight, that works just fine. I haven't really written one before, but its kind of similar syntax since I know C++/C# and VB. My question is, even though this works for what I need it do, is it written correctly? Can you see any problems with it, or would you have done it differently? I want to make sure its done correctly, and it runs as fast as possible. Thanks! [pre] CREATE PROCEDURE CreateNewUser @UserID int out, @LoginID nvarchar(30), @Password nvarchar(30), @RegisterDate smalldatetime, @LoginIDExists nvarchar(30)AS /* Check to see if the loginID is already in use before attempting to save it. We MUST have a unique loginID for each user */ SELECT @LoginIDExists = loginID FROM users WHERE loginID = @LoginID /* If we pulled a value from the database, then the loginID already exists, return with error code 1 */ IF (@LoginIDExists = @LoginID) BEGIN SELECT 1 RETURN END ELSE BEGIN /* The loginID does not already exist, attemp to add the new user to the database. */ INSERT INTO users ( loginID, loginpassword, registerDate ) VALUES ( @LoginID, @Password, @RegisterDate ) /* Grab the UserID for the new user. */ SELECT @UserID = @@identity /* return with error code 0 */ SELECT 0 RETURN ENDGO [/pre]
I have a field called contact_id in a table. Datatype is integer and has an identity seed of 1 and an identity increment of 1. When new records are created, the increment sometimes skips numbers. (ex. 12,13,18,21). What's going on here? Am I losing records somewhere?
I have a field called contact_id in a table. Datatype is integer and has an identity seed of 1 and an identity increment of 1. When new records are created, the increment sometimes skips numbers. (ex. 12,13,18,21). There is absolutely no deletion of any kind going on. (i.e. My application (cold fusion) has no code whatsoever that is deleting records.) What's going on here? Am I losing records somewhere?
I am new to SQL Server 2005. I have tried to be a good student and learn on my own about designing the database. However, I am facing a blockage of getting data into the database. I want to verify I have setup the relationships correctly. Here is the tables.
1. A Manufacture has an Address. 2. A Manufacturer has one or more Distribution Points. 3. A Distribution Point has an Address.
The Manufacturer --> Address is a one-to-one relationship. The Distribution Point --> Address is a one-to-one relationship. The Manufacturer --> Distribution Point is a one-to-many relationship.
The manufacturer table has a FK to the address id (PK). The distribution table has a FK to the address id (PK). The distribution table has a FK to the Manufacturer id (PK). Address has several other FK, but not used in this scenario.
The INSERT and UPDATE Specification for the Delete Rule and Update Rule is set to "No Action" for the Manufacturer and Address tables. In the Distribution Point table, the relationship for the update rule involving the relationship with the Address and Manufacturer tables is set to CASCADE. What this tells me is SQL Server 2005 will update the table should changes occur in Address and Manufacturer table.
Is there anything else I can check to be sure the issue I am facing is NOT the deisgn of the database?
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:
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.
Basicaly this is isituation: Software that our company developing (in Visual Basic 2005 .NET) is supposed to deliver files to sever and get them from it over Internet. In database those files are stored as image files. But the problem is that when Internet connection is slow or unstable the data transion seems to srew things up. Therefore file that is saved in database is corrupted and when i get it back from db it's not possible to open it.
Question is this: How to ensure safer delivery of large data (large meaning up to 4 MB). Is there any strategy that is recommended or proven to be best there is to this point.
Our first guess was to make MP5 based checksum in software and send it with data and then on serverside make a new checksum wiht MP5 and check if those two match. Since I've never done this I wanted to know (in case you dont know any better way) *) what would be the code to use in order to make a MP5 checksum form Image and *) what the best best type of data for MP5 checksums (in tables and stuff)
I have a report in SQL Reporting Services that isn't displaying correctly. The report comprises a header and a simble table, typically consisting of 20 to 30 columns and 1-20 rows.
When I run the report IE, the table is truncated and only the first five columns are displayed. I can get the table to display correctly by doing one of the following:
Changing the report zoom - once the zoom has been changed, the report displays correctly even back at the default 100%
Moving to the next report page, then back to the first page
Refreshing the report by right-clicking and selecting 'Refresh' (not using the refresh button in the tool bar) What seems strange is that if I copy the truncated table from IE to Excel, the full table is copied so it appears that what I'm seeing is some kind of display issue. I've trawled Google and the forums but to no avail - can anyone help?
I have a report which exports to Excel fine but it exports 100% as 1 to XML. Is this how it is supposed to work or is it supposed to put 100? The textbox has a format code of "P".
because of the fact that the database sdf-file is stored on a cf-card, i want that all commit transactions will be flushed to the file immediately. So i want to open the database with the above property. But i don't know the type and value i have to place into the variant. The following code fragment gave me the error "DB_S_ERRORSOCCURRED when i try to set the property with IDBInitialize::SetProperties() :
//Initialize property set DBPROPSET_SSCE_SESSION dbpropset[1].guidPropertySet = DBPROPSET_SSCE_SESSION; dbpropset[1].rgProperties = dbprop_ssce_session; dbpropset[1].cProperties = 1; //(there is another property for the path not shown here)
I would appreciate it when someone out there knows the answer and could tell me.
I have a conditional split where i check for First name ,Last name to see if they are empty.
this is the condition i specify in the conditional split ISNULL(Column Name)
It dosent remove rows which are empty to a different output.. I tried trim the input column using derived column before sending the data to conditional split but nothing worked.
but after loading the data when i query in the database select * from TBL_Name Where Column Name =' '
Using the SSMS Import and Export Wizard, I am trying to export tables from one database into another within the same sql server instance but am getting the error message below. I tried exporting one table; still doesn't work. I copied the wizard generated CREATE TABLE sql statement and ran it in a query in SSMS without incident. I looked up ResultSet property in BOL but there is no entry for it; just ResultSets and ResultSetType. How does one set ResultSet? I have frequently exported to text files without this problem. Can anybody help resolve this?
- Execute the transfer with the TransferProvider. (Error)
Messages
ERROR : errorCode=-1073548784 description=Executing the query "" failed with the following error: "Retrieving the COM class factory for component with CLSID {7816B7A3-CD60-4539-BD38-C35AFC61F200} failed due to the following error: 80040153.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly. helpFile= helpContext=0 idofInterfaceWithError={8BDFE893-E9D8-4D23-9739-DA807BCDC2AC}
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&LinkId=20476
ERROR : errorCode=-1073548784 description=Executing the query "" failed with the following error: "Retrieving the COM class factory for component with CLSID {7816B7A3-CD60-4539-BD38-C35AFC61F200} failed due to the following error: 80040153.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly. helpFile= helpContext=0 idofInterfaceWithError={8BDFE893-E9D8-4D23-9739-DA807BCDC2AC} (Microsoft.SqlServer.DtsTransferProvider)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&LinkId=20476
Hi. I have a stored procedure that I'm interacting with through vb.net... the stored procedure logic, by itself, runs in query analyzer, but when I run it from the code side using the stored procedure, it dies. Now, that said, I'm not a pro at writing a stored procedure, so you might look at this and gasp in horror. I'm executing a three-staged query, all of which are using temp tables, the final of which is what I'm using for my datagrid import. The temp table name I'm using doesn't work... it's not accepted in the SP and stops the execution of the query stating "invalid table name." Not being a guru at this, I dont know why it runs in Query Analyzer but not w/i the SP. Can someone look at this and help? (If its grossly written and there's a better way, I wouldn't be offended to be told that either. I"m looking for ways to write cleaner, faster code) Here is the SP, any suggestions are very very appreciated. Thanks so much!
CREATE PROCEDURE sp_PCPPanel_Summary (@strWHEREMale as varchar(500), @strWHEREFemale as varchar(500)) AS EXEC(' SELECT Gender, RealAge, WeightedAge, FWeight, Mweight, AccountNum, PatLastName, PatFirstName, PatAddress, Patcity, PatState , PatZip, Tertiary, PatientStatusKey, InsClass, InsClassDesc, PCPDr, PCPClass, InsurancePlan, CarrierKey, CarrierName, PlanName, Age INTO #tblTempPCP FROM( SELECT tblPCP.AccountNum, tblPCP.PatLastName, tblPCP.PatFirstName, tblPCP.PatAddress, tblPCP.PatCity, tblPCP.PatState, tblPCP.PatZip, tblPCP.PatPhone, tblPCP.DOB, tblPCP.Age, tblPCP.Gender, tblPCP.InsurancePlan, tblPCP.PCPClass, tblPCP.CarrierName, tblPCP.CarrierKey, tblPCP.PCPDr, tblPCP.PlanName, tblPCP.InsAddress, tblPCP.InsCity, tblPCP.InsState, tblPCP.InsZip, tblPCP.Tertiary, tblPCP.PatientStatusKey, dbo.tblPanelWeights.WeightedAge, dbo.tblPanelWeights.Category, 0 as MWeight, dbo.tblPanelWeights.Female as FWeight, dbo.tblPanelWeights.RealAge, tblPCP.InsClass, tblPCP.InsClassDesc, tblPCP.ApptDate FROM dbo.tblPanelWeights RIGHT OUTER JOIN dbo.[vwPCP+Continuity] tblPCP ON dbo.tblPanelWeights.RealAge = tblPCP.Age ' + @strWHEREFEMALE + ' UNION SELECT tblPCP.AccountNum, tblPCP.PatLastName, tblPCP.PatFirstName, tblPCP.PatAddress, tblPCP.PatCity, tblPCP.PatState, tblPCP.PatZip, tblPCP.PatPhone, tblPCP.DOB, tblPCP.Age, tblPCP.Gender, tblPCP.InsurancePlan, tblPCP.PCPClass, tblPCP.CarrierName, tblPCP.CarrierKey, tblPCP.PCPDr, tblPCP.PlanName, tblPCP.InsAddress, tblPCP.InsCity, tblPCP.InsState, tblPCP.InsZip, tblPCP.Tertiary, tblPCP.PatientStatusKey, dbo.tblPanelWeights.WeightedAge, dbo.tblPanelWeights.Category, dbo.tblPanelWeights.Male as MWeight, 0 as FWeight, dbo.tblPanelWeights.RealAge, tblPCP.InsClass, tblPCP.InsClassDesc, tblPCP.ApptDate FROM dbo.tblPanelWeights RIGHT OUTER JOIN dbo.[vwPCP+Continuity] tblPCP ON dbo.tblPanelWeights.RealAge = tblPCP.Age ' + @strWHEREMALE + ' ) unionWEIGHTS GROUP BY Gender, RealAge, WeightedAge, FWeight, Mweight, AccountNum, PatLastName, PatFirstName, PatAddress, patcity, patState , patZip, Tertiary, PatientStatusKey, InsClass, InsClassDesc, PCPDr, PCPClass, InsurancePlan, CarrierKey, CarrierName, PlanName, Age ORDER BY realage ')
SELECT isnull(cast(RealAge as varchar), 'Unknown') as AgeRange, RealAge as AgeSort, gender, mweight, fweight, [Male] = sum(case when gender = 'M' then 1 else 0 end), [Female] = sum(case when gender = 'F' then 1 else 0 end), count(*) as Totalinto #tblTempPCP2 FROM #tblTempPCPgroup by realage, gender, mweight, fweight
Select AgeRange, AgeSort, [MALE], [FEMALE], [Male Weighted] = case when gender = 'M' then Sum(MWeight * [MALE]) end, [Female Weighted] = case when gender = 'F' then Sum(FWeight * [FEMALE]) endfrom #tblTempPCP2group by AgeRange, AgeSort, [MALE], [FEMALE], gender, totalorder by AgeSortGO
Hello all .. I have a form that views the date automatically in a textbox... the date of this text box must be stored in the database after the user press the submit button ... However, I am getting a wrong date which is 01/01/1900 .. although I see it in the form as 15/01/2008 .. this is the code ... please give me a solution ASAP ..
Protected Sub SubmitButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles SubmitButton.Click 'Declaring the variablesDim objConnection As SqlConnection Dim objDataCommand As SqlCommand Dim courseId, traineeName, traineeId, department, comment1, comment2 As String Dim formDate As Date Dim RB1, RB2, RB3, RB4, RB5, RB6, RB7, RB8, RB9, RB10, RB11, RB12, RB13, RB14 As String Dim ConnectionString, evaluationSQL, TraSQL, iTotal As String 'Save form values in variables formDate = Convert.ToDateTime(DateTxt.Text) courseId = CourseIDTxt.Text traineeId = EmailTxt.Text traineeName = TraineeNTxt.Text department = DeptDropDownList.SelectedValue RB1 = RBL1.SelectedValue RB2 = RBL2.SelectedValue RB3 = RBL3.SelectedValue RB4 = RBL4.SelectedValue RB5 = RBL5.SelectedValue RB6 = RBL6.SelectedValue RB7 = RBL7.SelectedValue RB8 = RBL8.SelectedValue RB9 = RBL9.SelectedValue RB10 = RBL10.SelectedValue RB11 = RBL11.SelectedValue RB12 = RBL12.SelectedValue RB13 = RBL13.SelectedValue RB14 = RBL14.SelectedValue comment1 = CommentTxt1.Text comment2 = CommentTxt2.TextConnectionString = WebConfigurationManager.ConnectionStrings("GRPConnectionString").ConnectionString 'Create and open the connection objConnection = New SqlConnection(ConnectionString) objConnection.Open()evaluationSQL = "Insert into Evaluation (Eva_Date, CourseD_Id, Tra_Id , Q1, Q2, Q3, Q4, Q5, Q6, Q7, Q8, Q9, Q10, Q11, Q12, Q13, Q14, Comment1, Comment2 ) " & _ "values(" & formDate & ",'" & courseId & "','" & traineeId & "','" & RB1 & "','" & RB2 & "','" & RB3 & "','" & RB4 & "','" & RB5 & "','" & RB6 & "','" & RB7 & "','" & RB8 & "','" & RB9 & "','" & RB10 & "','" & RB11 & "','" & RB12 & "','" & RB13 & "','" & RB14 & "','" & comment1 & "','" & comment2 & "')"objDataCommand = New SqlCommand(evaluationSQL, objConnection) objDataCommand.ExecuteNonQuery()
STR(YEAR(DATEENTERED)) + '/' + STR(MONTH(DATEENTERED)) + '/' + STR(DAY(DATEENTERED)) AS DATETIME ) AS Date,
[From], [To], [Company], [Catagory], [Client], [Description], [TotalHours] FROM [JcpowersJobs]"
It will show correctly in the query builder test but when you load it up in the gridview it will show the date AND 12:00:00AM for every one of the dates
I tried replacing DATETIME with VARCHAR but it would insert spaces into the date where I didn't want them: EX: (12/04/1994 => 12/ 04/ 1994)