15,896,201 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Ruban Bharath (Top 14 by date)
Ruban Bharath
11-Oct-18 6:33am
View
why means i cannot get you?
Ruban Bharath
24-Aug-18 3:19am
View
Sorry sir ,yes sir results only for list and tuples but not for str it showed
Ruban Bharath
24-Aug-18 3:14am
View
I want to fetch the id of the quiz(quiz is a table with id,qname fields) from the front-end page and compare it with 1,2,3,4 and perform the function corresponding with condition
db = sqlite3.connect('db.sqlite3')
cursor = db.cursor()
quizid = request.GET.get('quizid')
cursor.execute('SELECT quizid,qname FROM music_quiz WHERE quizid = '+quizid)
data = cursor.fetchone()
but here i have a error like
can only concatenate str (not "NoneType") to str
Ruban Bharath
24-Aug-18 0:19am
View
okay sir but i have entered the value correctly only but it makes me a error.
Ruban Bharath
24-Aug-18 0:18am
View
Deleted
okay sir but i have defined correctly only based on this reference but also i got this err.
Ruban Bharath
23-Aug-18 8:10am
View
sorry i am not clear with it can you tell me broadly please sir
Ruban Bharath
23-Aug-18 7:23am
View
views.py
def olddata(request):
username = request.POST.get("username", False)
if is_valid(username):
data = result.objects.filter(username=username)
return render(request, "result/index.html", {'data': data})
else:
name = Name(username=username)
name.save()
db = sqlite3.connect('db.sqlite3')
cursor = db.cursor()
cursor.execute('''SELECT meaning from music_sample''')
rand = cursor.fetchall()
rand_item = rand[random.randrange(len(rand))]
cursor.execute('INSERT INTO music_sample1(userid,meaning) values(NULL,?)', rand_item)
cursor.execute('''INSERT INTO music_result SELECT username,meaning, NULL
FROM music_name N JOIN music_sample1 T ON N.userid = T.userid ''')
db.commit()
for row in result.objects.all():
if result.objects.filter(username=row.username).count() > 1:
row.delete()
data = result.objects.filter(username=username)
return render(request, "result/index.html", {'data': data})
def is_valid(username):
con = sqlite3.connect('db.sqlite3')
cur = con.cursor()
cur.execute('SELECT username FROM music_output')
data = cur.fetchall()
for row in data:
if row[0] == username:
return True
return False
then my models are:
class sample(models.Model):
userid = models.IntegerField(primary_key=True)
meaning = models.CharField(max_length=300)
class sample1(models.Model):
userid = models.IntegerField(primary_key=True)
meaning = models.CharField(max_length=300)
class Name(models.Model):
userid = models.IntegerField(primary_key=True)
username = models.CharField(max_length=300,)
class result(models.Model):
userid = models.IntegerField()
meaning = models.CharField(max_length=300)
username = models.CharField(max_length=300)
what's wrong with this code i am getting error now like
"NOT NULL constraint failed: music_sample1.userid"
Ruban Bharath
23-Aug-18 7:20am
View
NO sir i could not resolved it
i will show my contents to you
Ruban Bharath
23-Aug-18 6:04am
View
class sample(models.Model):
userid = models.IntegerField(primary_key=True)
meaning = models.CharField(max_length=300)
class sample1(models.Model):
userid = models.IntegerField(primary_key=True)
meaning = models.CharField(max_length=300)
class Name1(models.Model):
userid = models.IntegerField(primary_key=True)
username = models.CharField(max_length=300)
class result(models.Model):
userid = models.IntegerField(primary_key=True)
meaning = models.CharField(max_length=300)
username = models.CharField(max_length=300)
Ruban Bharath
23-Aug-18 4:54am
View
sir sorry what is meant by field definition
are you asking about table creation query
Ruban Bharath
23-Aug-18 4:44am
View
Sir if i remove the NULL
i have this error what can i do for it
sorry i have userId field too in result table
"table music_result has 3 columns but 2 values were supplied"
Ruban Bharath
14-Aug-18 0:39am
View
sir, i have tried your code but it shoots me this error
ambiguous column name: genderId
Ruban Bharath
13-Aug-18 7:43am
View
no sir this is actually not my original design but i need to know how to join two tables into one sir,but the concept is same i have two tables with different fields i wanna join them but i have tried but it emerges an error
i got struct in it for an whole day sir
Ruban Bharath
13-Aug-18 7:33am
View
okay kindly tell me that what is the procedure to join these tables sir.Thank you in advanced
Show More