|
Thank you for your observation.
|
|
|
|
|
You're more than welcome..
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
And when you run it using the different methods do you
- Use EXACTLY the same data. How do you know?
- Use EXACTLY the same database? How did you verify it?
|
|
|
|
|
One of the issues I have run across over time is in the data itself. If your source is a legacy system then there may be a crlf issue, it can be either 1 or 2 characters. They sometimes use weird row terminators as well.
I would check if AS is the last field in a row and then pull the data into a string and check the length of the field. VS may well treat line feeds differently than SSIS.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
[795]] Warning: Truncation may occur due to inserting data from data flow column "AS" with a length of 16 to database column "AS" with a length of 15.
I resolved this issue yesterday but today it failed again.
The package is successful if I run from Microsoft Visual studio. However, if I run initiate the job through SQL job agent it will fail.
Does anyone have a better idea to resolve this?
|
|
|
|
|
I took Jorgen's advice and modified my Movie database
I split the table into 2, the first table being movie information and the 2nd table being FLV information
So I can do the JOINs in displaying the data, and using it to create a Flash Movie Player,
But it just dawned on me that I have no clue on how to insert and update records for my new setup here.
So I came up with this.
My question, am I on the right track here, Inserting the first table, getting the ID of the record so I can use the ID in the 2nd table?
Or is there a better way in which I can insert in one shot?
I'm not ready to write stored procedures yet, in case that is suggested.
INSERT INTO MovieInfo(
MovieName, MovieType, MoviePath, MoviePostage, MovieThumbnail, flv, h264
)
VALUES(
@MovieName, @MovieType, @MoviePath, @MoviePostage, @MovieThumbnail, @flv, @H264
);
DECLARE @mID AS INT;
SET @mID = (
SELECT MovieID FROM MovieInfo WHERE MovieName=@MovieName
)
INSERT INTO MovieInfo_flv(
movieID, flv_movieName, flv_skin, flv_folderpath, flv_filename
)
VALUES(
@mID, @flv_movieName, @flv_skin, @flv_folderpath, @flv_filename
)
modified 17-Mar-14 18:07pm.
|
|
|
|
|
You either do this as a 2 statement operation or you create a stored procedure - the SP path is by far the simplest an most robust.
I presume you have an IDENTITY field the Movie table. So when a record is inserted the system puts the new ID into a variable called @Scope_Identity you can get the value from there.
I used stored procs for EVERYTHING, the UI/Service NEVER talks directly to a table/view, so I have a code generator to build my CRUD procs. So I am not going to be able to help with string inserts
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Well thanks for the confirmation on that. I guess I'll take a stab on stored procedures then.
|
|
|
|
|
So here is some pseudo code for that.
Declare incoming variables
Insert into student table
Get Scope_Identity into a variable
Check for existing course - this may be done in the client
Insert missing course
Get Scope_Identity into another variable
Insert variables into link table (this is a many to many table linking the course and the student records)
Return the student record - I do this so the client has all the information about the student including the ID value.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
OK
I can swap out the words like student on that
I'll write one and post it to see how I did on it.
Thanks!
|
|
|
|
|
How do I structure my database tables so that it can allow many users to login simultaneously in my chat Application. While testing it in my IE and Crome in my PC.
Thanks.
|
|
|
|
|
What is it about the structure of the database that would prevent many users from logging in simultaneously? What problem are you facing?
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
I'm creating a chat App that will run online its includes signalR for real time messages. So now I'm trying to check if its can allow multiple users to log in in the in the same time using two browsers on my computer. when I check that I found that its override the first user that has being logged in first.
|
|
|
|
|
sbangani wrote: How do I structure my database tables so that it can allow many users to login simultaneously A database-server is designed to cater to multiple clients.
Simply do not use a desktop database (like MSAccess) and it should work out-of-the-box.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
I doubt you can design a database that doesn't allow multiple users.
You can certainly design/implement an application that uses a database which precludes that.
|
|
|
|
|
Hi All,
I want to get the result according to comma seperated value in field. First let me explain the table and their data
I have one table which contain following fields and data
file sequence || Cat_Id || Sequence
4,1,5,8,9,10,20 || 41 || 2
18,17,19,24,25 || 48 || 9
19,21,22,23,24,25,26 || 49 || 10
above is the sample data structure which contains the data in above format. Now I want to create a query which rerurn the value of file_sequence field in following format
4,1,5,8,9,10,20,18,17,19,24,25,21,22,26
Here one thing Which I want to notify
1. above table is result of a query which is sorted on the base of Sequence
2. Now we pick the result of field_sequence from the start in the same order.
3. now we pick the 4,1,5,8,9,10,20 then 18,17,19,24,25 and then 21,22,26
4. duplicate value removed (in above example 19,24,25 are duplicate)
so in this way I want to get the comma seperated value
4,1,5,8,9,10,20,18,17,19,24,25,21,22,26
Please suggest/guide how can i achieve this result
|
|
|
|
|
Maybe not the answer you're looking for, but your table doesn't even conform to the first normal form.
Normalize it, for example like this:
CREATE TABLE MyTable
([fileid] int, [filesequence] int, [catid] int, [catsequence] int)
;
INSERT INTO MyTable
([fileid], [filesequence], [catid], [catsequence])
VALUES
(4, 1, 41, 2),
(1, 2, 41, 2),
(5, 3, 41, 2),
(8, 4, 41, 2),
(9, 5, 41, 2),
(10, 6, 41, 2),
(20, 7, 41, 2),
(18, 1, 48, 9),
(17, 2, 48, 9),
(19, 3, 48, 9),
(24, 4, 48, 9),
(25, 5, 48, 9),
(19, 1, 49, 10),
(21, 2, 49, 10),
(22, 3, 49, 10),
(23, 4, 49, 10),
(24, 5, 49, 10),
(25, 6, 49, 10),
(26, 7, 49, 10)
; Now you can Query it like this:
select fileid
from mytable
group by fileid
order by min(catsequence),min(filesequence)
And the result will look like this:
FILEID
4
1
5
8
9
10
20
18
19
17
24
25
21
22
23
26 It's easy enough to make that into a comma separated file if you would really need to.
But that task actually belongs to another layer than the database.
|
|
|
|
|
hi,
am using query as
Select machine_id as MachineID,item_name as Name,SUM(item_quantity) as Quantity,SUM(billed_amount) as BilledAmount,SUM(received_amount) as ReceivedAmount from transaction where DATE(paid_date)='" + rdate + "'Group by machine_id,item_name
here rdate , am collecting from UI,
string rdate = dateTimePicker1.Value.ToString("yyyy-MM-dd");
MachineID Name Quantity BilledAmount ReceivedAmount
V0001 petrol 61 244 244
V0002 Diesel 186 726 726
V0002 petrol 155 605 605
Total 402 1575 1575
But i want for every machine id ,total row
V0001 - - - -
total - - -
V0001 - - - -
total - - -
modified 14-Mar-14 2:33am.
|
|
|
|
|
You are trying to make the database do the work of the UI, wrong tool for the job. You either need to use a reporting tool that will format the totals or do it yourself. This depends on your consumer.
Good to see you asking a more sensible question.
Do some research into parameterised queries and "Little Bobby Tables". One will make you life easier and the other may save you from disaster.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Your GUI is written in C#, isn't it? So I'd suggest to do that extra calculation and formatting there.
|
|
|
|
|
hi,
i need to get data from database on monthly basis.i need to select month from UI, based on that , i want the records in database.
am using Mysql database in c#,
any suggestions
|
|
|
|
|
Member 10263519 wrote: any suggestions
Sure, craft a select query either as a stored procedure or a string query (remember to use parameters), make a connection to the database, and either execute your query string orthe stored procedure. Bind the results to your display control.
Just what are you expecting as an answer to a request for suggestions?
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
|
<%--
Document : check
Created on : Mar 10, 2014, 7:52:19 PM
Author : Sahara
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Student Information</title>
</head>
<body>
<h3><%
String nameHeader = request.getParameter("name");
out.print(nameHeader);
%></h3>
<%@page import = "java.sql.*" %>
<%@page import = "java.io.*" %>
<%@page import = "com.mysql.jdbc.Driver" %>
="1.0"
<%
String name = request.getParameter("name");
String subject = request.getParameter("subject");
String roll = request.getParameter("roll");
String Student = "INSERT INTO student(roll,name) VALUES('"+roll+"','"+name+"')";
String Subject = "INSERT INTO subject(name) VALUES('"+subject+"')";
try{
Connection connection = null;
Statement statement = null;
ResultSet result = null;
Class.forName("com.mysql.jdbc.Driver").newInstance();
connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/normalization","root","");
statement = connection.createStatement();
statement.executeUpdate(Student);
statement.executeUpdate(Subject);
}catch(SQLException e){
out.println("Error: Connection To Database...");
out.println("Error:"+e);
}
%>
</body>
</html>
Error:java.sql.SQLException: Field 'idfk' doesn't have a default value
it is the error which i am facing it from last 3 months. I have created the tables fully correct
Faisal Abdullah
|
|
|
|
|
Faisal_Abdullah wrote: Error:java.sql.SQLException: Field 'idfk' doesn't have a default value
It looks like you have a column which requires data and you are not providing it. Which table has the column "dfk"?
.AK.
|
|
|
|
|